Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c8020f0964 | |||
| 4ca7df7043 |
Generated
+13
-13
@@ -329,7 +329,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-browser"
|
name = "custos-browser"
|
||||||
version = "0.22.0"
|
version = "0.22.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"psl",
|
"psl",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
@@ -337,7 +337,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-gen"
|
name = "custos-gen"
|
||||||
version = "0.22.0"
|
version = "0.22.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"custos-vault",
|
"custos-vault",
|
||||||
"data-encoding",
|
"data-encoding",
|
||||||
@@ -349,7 +349,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-kdbx"
|
name = "custos-kdbx"
|
||||||
version = "0.22.0"
|
version = "0.22.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes",
|
"aes",
|
||||||
"argon2",
|
"argon2",
|
||||||
@@ -370,7 +370,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-keys"
|
name = "custos-keys"
|
||||||
version = "0.22.0"
|
version = "0.22.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"custos-vault",
|
"custos-vault",
|
||||||
"ed25519-dalek",
|
"ed25519-dalek",
|
||||||
@@ -383,7 +383,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-native"
|
name = "custos-native"
|
||||||
version = "0.22.0"
|
version = "0.22.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"custos-browser",
|
"custos-browser",
|
||||||
"rand 0.10.3",
|
"rand 0.10.3",
|
||||||
@@ -394,11 +394,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-qr"
|
name = "custos-qr"
|
||||||
version = "0.22.0"
|
version = "0.22.1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-seal"
|
name = "custos-seal"
|
||||||
version = "0.22.0"
|
version = "0.22.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chacha20poly1305",
|
"chacha20poly1305",
|
||||||
"hkdf",
|
"hkdf",
|
||||||
@@ -411,7 +411,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-share"
|
name = "custos-share"
|
||||||
version = "0.22.0"
|
version = "0.22.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"argon2",
|
"argon2",
|
||||||
"chacha20poly1305",
|
"chacha20poly1305",
|
||||||
@@ -428,7 +428,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-sign"
|
name = "custos-sign"
|
||||||
version = "0.22.0"
|
version = "0.22.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"blake2 0.10.6",
|
"blake2 0.10.6",
|
||||||
"data-encoding",
|
"data-encoding",
|
||||||
@@ -448,7 +448,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-team"
|
name = "custos-team"
|
||||||
version = "0.22.0"
|
version = "0.22.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"custos-seal",
|
"custos-seal",
|
||||||
"custos-sign",
|
"custos-sign",
|
||||||
@@ -466,7 +466,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-totp"
|
name = "custos-totp"
|
||||||
version = "0.22.0"
|
version = "0.22.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"custos-vault",
|
"custos-vault",
|
||||||
"data-encoding",
|
"data-encoding",
|
||||||
@@ -479,7 +479,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-vault"
|
name = "custos-vault"
|
||||||
version = "0.22.0"
|
version = "0.22.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"argon2",
|
"argon2",
|
||||||
"bip39",
|
"bip39",
|
||||||
@@ -505,7 +505,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "custos-wasm"
|
name = "custos-wasm"
|
||||||
version = "0.22.0"
|
version = "0.22.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"custos-qr",
|
"custos-qr",
|
||||||
"custos-seal",
|
"custos-seal",
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ resolver = "3"
|
|||||||
members = ["crates/*"]
|
members = ["crates/*"]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.22.0"
|
version = "0.22.1"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "CPAL-1.0"
|
license = "CPAL-1.0"
|
||||||
repository = "https://gitea.marek-novak.cz/mnovak/CustosPublic"
|
repository = "https://gitea.marek-novak.cz/mnovak/CustosPublic"
|
||||||
|
|||||||
+11
-6
@@ -31,11 +31,16 @@
|
|||||||
const s = getComputedStyle(el);
|
const s = getComputedStyle(el);
|
||||||
return r.width > 0 && r.height > 0 && s.visibility !== 'hidden' && s.display !== 'none' && !el.disabled && !el.readOnly;
|
return r.width > 0 && r.height > 0 && s.visibility !== 'hidden' && s.display !== 'none' && !el.disabled && !el.readOnly;
|
||||||
};
|
};
|
||||||
const isText = (el) => el instanceof HTMLInputElement && ['text', 'email', 'tel'].includes(el.type);
|
const isText = (el) => el instanceof HTMLInputElement && ['text', 'email', 'tel', 'number'].includes(el.type);
|
||||||
|
// The page's own autocomplete words: the attribute, not the property (Gecko gives '' for a word it does not know,
|
||||||
|
// such as one-time-code).
|
||||||
|
const auto = (el) => (el.getAttribute('autocomplete') ?? '').toLowerCase();
|
||||||
const isOtp = (el) =>
|
const isOtp = (el) =>
|
||||||
el instanceof HTMLInputElement &&
|
el instanceof HTMLInputElement &&
|
||||||
(el.autocomplete === 'one-time-code' || /(^|[^a-z])(otp|totp|2fa|mfa|one.?time|verification.?code)/i.test(`${el.name} ${el.id}`));
|
(auto(el).includes('one-time-code') ||
|
||||||
const isUserName = (el) => isText(el) && /username|email/i.test(`${el.autocomplete} ${el.name} ${el.id} ${el.type}`);
|
/(^|[^a-z])(otp|totp|2fa|mfa|one.?time|verification.?code)/i.test(`${el.name} ${el.id}`) ||
|
||||||
|
(el.inputMode === 'numeric' && /(^|[^a-z])code([^a-z]|$)/i.test(`${el.name} ${el.id}`)));
|
||||||
|
const isUserName = (el) => isText(el) && /username|email/i.test(`${auto(el)} ${el.name} ${el.id} ${el.type}`);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The fields of a sign-up or change-password form that take a new password (and its repeat), around `near` (a
|
* The fields of a sign-up or change-password form that take a new password (and its repeat), around `near` (a
|
||||||
@@ -46,10 +51,10 @@
|
|||||||
const scope = near?.form ?? near?.closest?.('form') ?? document;
|
const scope = near?.form ?? near?.closest?.('form') ?? document;
|
||||||
const pws = [...scope.querySelectorAll('input[type=password]')].filter(visible);
|
const pws = [...scope.querySelectorAll('input[type=password]')].filter(visible);
|
||||||
const marked = pws.filter(
|
const marked = pws.filter(
|
||||||
(el) => el.autocomplete === 'new-password' || /(^|[^a-z])(new|confirm|repeat|again|retype)/i.test(`${el.name} ${el.id}`),
|
(el) => auto(el).includes('new-password') || /(^|[^a-z])(new|confirm|repeat|again|retype)/i.test(`${el.name} ${el.id}`),
|
||||||
);
|
);
|
||||||
if (marked.length) return marked;
|
if (marked.length) return marked;
|
||||||
if (pws.length === 2 && pws.every((el) => el.autocomplete !== 'current-password')) return pws;
|
if (pws.length === 2 && pws.every((el) => !auto(el).includes('current-password'))) return pws;
|
||||||
if (pws.length === 3) return pws.slice(1);
|
if (pws.length === 3) return pws.slice(1);
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -66,7 +71,7 @@
|
|||||||
/** The username field of a password field: the one the page marks, else the last text field before it. */
|
/** The username field of a password field: the one the page marks, else the last text field before it. */
|
||||||
function usernameFor(pw) {
|
function usernameFor(pw) {
|
||||||
const inputs = [...(pw.form ?? document).querySelectorAll('input')].filter(visible);
|
const inputs = [...(pw.form ?? document).querySelectorAll('input')].filter(visible);
|
||||||
const marked = inputs.find((el) => isText(el) && /username|email/i.test(el.autocomplete));
|
const marked = inputs.find((el) => isText(el) && /username|email/i.test(auto(el)));
|
||||||
if (marked) return marked;
|
if (marked) return marked;
|
||||||
for (let i = inputs.indexOf(pw) - 1; i >= 0; i--) if (isText(inputs[i]) && !isOtp(inputs[i])) return inputs[i];
|
for (let i = inputs.indexOf(pw) - 1; i >= 0; i--) if (isText(inputs[i]) && !isOtp(inputs[i])) return inputs[i];
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user