Add new tests for TOTP formDetector (#1788)

This commit is contained in:
Leendert de Borst
2026-02-27 17:30:34 +01:00
committed by Leendert de Borst
parent 82dfd75cfc
commit 5a63ea7803
3 changed files with 30 additions and 1 deletions

View File

@@ -50,7 +50,7 @@ export const EnglishFieldPatterns: FieldPatterns = {
birthDateDay: ['-day', 'birthdate_d', 'birthdayday', '_day', 'day'],
birthDateMonth: ['-month', 'birthdate_m', 'birthdaymonth', '_month', 'month'],
birthDateYear: ['-year', 'birthdate_y', 'birthdayyear', '_year', 'year'],
totp: ['totp', 'otp', 'one-time', 'onetime', 'token', 'authenticator', '2fa', 'twofa', 'two-factor', 'mfa', 'security-code', 'auth-code', 'passcode', 'pin-code', 'pincode']
totp: ['totp', 'otp', 'one-time', 'onetime', 'token', 'authenticator', '2fa', 'twofa', 'two-factor', 'mfa', 'security-code', 'auth-code', 'passcode', 'pin-code', 'pincode', 'google_code', 'verification-code', 'verificationcode']
};
/**

View File

@@ -24,4 +24,10 @@ describe('FormDetector TOTP tests', () => {
testField(FormField.Totp, 'two-fa-challenge-authenticator_pc_input_0', htmlFile);
});
describe('English TOTP form 3 detection (Google Authenticator style)', () => {
const htmlFile = 'en-totp-form3.html';
testField(FormField.Totp, 'google_code', htmlFile);
});
});

View File

@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<title>Google Authenticator (TFA)</title>
</head>
<body>
<div class="login-container-box" id="signin-section">
<div class="login-box">
<h3 class="ph-title"><span>Google Authenticator (TFA)</span></h3>
<div style="padding-left: 0">
<p>Exécutez l'application Google Authenticator sur votre appareil mobile et entrez le code de vérification dans le champ ci-dessous.</p>
</div>
<form action="/validate_google_token" method="post">
<input type="hidden" name="authenticity_token" value="asdasdasdasd+vyR/2jVQ==" />
<div class="col-12 form-group">
<input id="google_code" name="google_code" type="text" value="" class="form-control" required autocomplete="off" placeholder="Saisir le Code" />
</div>
<input type="submit" id="loginbutt" class="ph-default-button orange-button" value="Se connecter"/>
</form>
</div>
</div>
</body>
</html>