mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-24 21:46:22 -04:00
[mfa] allow faking MFA in development
This commit is contained in:
parent
19fe488b5d
commit
ce5afe1b23
@ -98,13 +98,17 @@ router.post('/mfa/validate', handleErrorAsync(async (req, res) => {
|
||||
|
||||
const authenticator = (await findAuthenticatorsByUser(req.db, req.rawUser, 'mfa_secret'))[0];
|
||||
|
||||
const tokenValidates = speakeasy.totp.verify({
|
||||
let tokenValidates = speakeasy.totp.verify({
|
||||
secret: authenticator.payload,
|
||||
encoding: 'base32',
|
||||
token: normalise(req.body.code),
|
||||
window: 6
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV === 'development' && normalise(req.body.code) === '999999') {
|
||||
tokenValidates = true;
|
||||
}
|
||||
|
||||
if (!tokenValidates) {
|
||||
return res.json({error: 'user.code.invalid'});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user