MFA login: be less sensitive about the error response

glitchtip
Alex Gleason 2022-01-12 10:52:28 -06:00
rodzic 9f08e63372
commit c1cfd2ca2a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 3 dodań i 6 usunięć

Wyświetl plik

@ -45,10 +45,7 @@ class OtpAuthForm extends ImmutablePureComponent {
this.setState({ shouldRedirect: true }); this.setState({ shouldRedirect: true });
return dispatch(switchAccount(account.id)); return dispatch(switchAccount(account.id));
}).catch(error => { }).catch(error => {
this.setState({ isLoading: false }); this.setState({ isLoading: false, code_error: true });
if (error.response.data.error === 'Invalid code') {
this.setState({ code_error: true });
}
}); });
this.setState({ isLoading: true }); this.setState({ isLoading: true });
event.preventDefault(); event.preventDefault();
@ -82,11 +79,11 @@ class OtpAuthForm extends ImmutablePureComponent {
</div> </div>
</div> </div>
</fieldset> </fieldset>
{ code_error && {code_error && (
<div className='error-box'> <div className='error-box'>
<FormattedMessage id='login.otp_log_in.fail' defaultMessage='Invalid code, please try again.' /> <FormattedMessage id='login.otp_log_in.fail' defaultMessage='Invalid code, please try again.' />
</div> </div>
} )}
<div className='actions'> <div className='actions'>
<button name='button' type='submit' className='btn button button-primary'> <button name='button' type='submit' className='btn button button-primary'>
<FormattedMessage id='login.log_in' defaultMessage='Log in' /> <FormattedMessage id='login.log_in' defaultMessage='Log in' />