mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Merge pull request #1142 from keepassxreboot/feature/add_predefined_sites_to_totp
Add TOTP possibility to Predefined Sites
This commit is contained in:
commit
51e0d9cf0d
3 changed files with 12 additions and 3 deletions
|
|
@ -66,3 +66,12 @@ kpxcSites.exceptionFound = function(classList) {
|
|||
|
||||
return false;
|
||||
};
|
||||
|
||||
kpxcSites.expectedTOTPMaxLength = function() {
|
||||
if (document.location.origin.startsWith('https://www.amazon')
|
||||
&& document.location.href.includes('/ap/mfa')) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
return MAX_TOTP_INPUT_LENGTH;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
const ignoreRegex = /(bank|coupon|postal|user|zip).*code|comment|author/i;
|
||||
const ignoredTypes = [ 'email', 'password', 'username' ];
|
||||
const MIN_INPUT_LENGTH = 6;
|
||||
const MAX_INPUT_LENGTH = 10;
|
||||
|
||||
const acceptedOTPFields = [
|
||||
'2fa',
|
||||
|
|
@ -57,7 +55,7 @@ kpxcTOTPIcons.isValid = function(field, forced) {
|
|||
if (ignoredTypes.some(t => t === field.type)
|
||||
|| field.offsetWidth < MINIMUM_INPUT_FIELD_WIDTH
|
||||
|| field.size < 2
|
||||
|| (field.maxLength > 0 && (field.maxLength < MIN_INPUT_LENGTH || field.maxLength > MAX_INPUT_LENGTH))
|
||||
|| (field.maxLength > 0 && (field.maxLength < MIN_TOTP_INPUT_LENGTH || field.maxLength > kpxcSites.expectedTOTPMaxLength()))
|
||||
|| ignoredTypes.some(t => t === field.autocomplete)
|
||||
|| field.id.match(ignoreRegex)
|
||||
|| field.name.match(ignoreRegex)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
const MINIMUM_INPUT_FIELD_WIDTH = 60;
|
||||
const MIN_TOTP_INPUT_LENGTH = 6;
|
||||
const MAX_TOTP_INPUT_LENGTH = 10;
|
||||
|
||||
const DatabaseState = {
|
||||
DISCONNECTED: 0,
|
||||
|
|
|
|||
Loading…
Reference in a new issue