Skip to content

Commit

Permalink
Add OTP field to login request if 2FA is activated
Browse files Browse the repository at this point in the history
  • Loading branch information
vuilleumierc committed Aug 16, 2023
1 parent b7d8d91 commit 4b957b7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/auth/FormElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,12 +477,16 @@ export default class GmfAuthForm extends GmfBaseElement {
if (pwdVal === '') {
errors.push(i18next.t('The password is required.'));
}
let otpVal = '';
if (this.twoFactorAuth) {
otpVal = (form.otp as HTMLInputElement).value;
}
if (errors.length) {
this.isLoading = false;
this.setError_(errors);
} else {
authenticationService
.login(loginVal, pwdVal)
.login(loginVal, pwdVal, otpVal)
.then(() => {
this.cleanForm_();
this.resetError_();
Expand Down

0 comments on commit 4b957b7

Please sign in to comment.