Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c8020f0964 | |||
| 4ca7df7043 | |||
| 077112492a |
Generated
+13
-13
@@ -329,7 +329,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "custos-browser"
|
||||
version = "0.22.0"
|
||||
version = "0.22.1"
|
||||
dependencies = [
|
||||
"psl",
|
||||
"zeroize",
|
||||
@@ -337,7 +337,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "custos-gen"
|
||||
version = "0.22.0"
|
||||
version = "0.22.1"
|
||||
dependencies = [
|
||||
"custos-vault",
|
||||
"data-encoding",
|
||||
@@ -349,7 +349,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "custos-kdbx"
|
||||
version = "0.22.0"
|
||||
version = "0.22.1"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"argon2",
|
||||
@@ -370,7 +370,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "custos-keys"
|
||||
version = "0.22.0"
|
||||
version = "0.22.1"
|
||||
dependencies = [
|
||||
"custos-vault",
|
||||
"ed25519-dalek",
|
||||
@@ -383,7 +383,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "custos-native"
|
||||
version = "0.22.0"
|
||||
version = "0.22.1"
|
||||
dependencies = [
|
||||
"custos-browser",
|
||||
"rand 0.10.3",
|
||||
@@ -394,11 +394,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "custos-qr"
|
||||
version = "0.22.0"
|
||||
version = "0.22.1"
|
||||
|
||||
[[package]]
|
||||
name = "custos-seal"
|
||||
version = "0.22.0"
|
||||
version = "0.22.1"
|
||||
dependencies = [
|
||||
"chacha20poly1305",
|
||||
"hkdf",
|
||||
@@ -411,7 +411,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "custos-share"
|
||||
version = "0.22.0"
|
||||
version = "0.22.1"
|
||||
dependencies = [
|
||||
"argon2",
|
||||
"chacha20poly1305",
|
||||
@@ -428,7 +428,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "custos-sign"
|
||||
version = "0.22.0"
|
||||
version = "0.22.1"
|
||||
dependencies = [
|
||||
"blake2 0.10.6",
|
||||
"data-encoding",
|
||||
@@ -448,7 +448,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "custos-team"
|
||||
version = "0.22.0"
|
||||
version = "0.22.1"
|
||||
dependencies = [
|
||||
"custos-seal",
|
||||
"custos-sign",
|
||||
@@ -466,7 +466,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "custos-totp"
|
||||
version = "0.22.0"
|
||||
version = "0.22.1"
|
||||
dependencies = [
|
||||
"custos-vault",
|
||||
"data-encoding",
|
||||
@@ -479,7 +479,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "custos-vault"
|
||||
version = "0.22.0"
|
||||
version = "0.22.1"
|
||||
dependencies = [
|
||||
"argon2",
|
||||
"bip39",
|
||||
@@ -505,7 +505,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "custos-wasm"
|
||||
version = "0.22.0"
|
||||
version = "0.22.1"
|
||||
dependencies = [
|
||||
"custos-qr",
|
||||
"custos-seal",
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ resolver = "3"
|
||||
members = ["crates/*"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.22.0"
|
||||
version = "0.22.1"
|
||||
edition = "2024"
|
||||
license = "CPAL-1.0"
|
||||
repository = "https://gitea.marek-novak.cz/mnovak/CustosPublic"
|
||||
|
||||
+11
-6
@@ -31,11 +31,16 @@
|
||||
const s = getComputedStyle(el);
|
||||
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) =>
|
||||
el instanceof HTMLInputElement &&
|
||||
(el.autocomplete === 'one-time-code' || /(^|[^a-z])(otp|totp|2fa|mfa|one.?time|verification.?code)/i.test(`${el.name} ${el.id}`));
|
||||
const isUserName = (el) => isText(el) && /username|email/i.test(`${el.autocomplete} ${el.name} ${el.id} ${el.type}`);
|
||||
(auto(el).includes('one-time-code') ||
|
||||
/(^|[^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
|
||||
@@ -46,10 +51,10 @@
|
||||
const scope = near?.form ?? near?.closest?.('form') ?? document;
|
||||
const pws = [...scope.querySelectorAll('input[type=password]')].filter(visible);
|
||||
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 (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);
|
||||
return [];
|
||||
}
|
||||
@@ -66,7 +71,7 @@
|
||||
/** The username field of a password field: the one the page marks, else the last text field before it. */
|
||||
function usernameFor(pw) {
|
||||
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;
|
||||
for (let i = inputs.indexOf(pw) - 1; i >= 0; i--) if (isText(inputs[i]) && !isOtp(inputs[i])) return inputs[i];
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user