Support MFA recovery tokens
This commit is contained in:
@@ -54,6 +54,23 @@ class MFAController extends Controller {
|
||||
...this.Vue.session(req),
|
||||
})
|
||||
}
|
||||
|
||||
async get_recovery(req, res, next) {
|
||||
if (
|
||||
!req.user.mfa_enabled
|
||||
|| !Array.isArray(req.user.mfa_token.recovery_codes)
|
||||
|| req.user.mfa_token.recovery_codes.length < 1
|
||||
) return this.Vue.auth_message(res, {
|
||||
message: 'Unfortunately, it looks like your account does not have any MFA recovery codes generated.',
|
||||
next_destination: '/auth/mfa/challenge',
|
||||
button_text: 'Go Back',
|
||||
})
|
||||
|
||||
return res.page('auth:mfa:recovery', {
|
||||
...this.Vue.data(),
|
||||
...this.Vue.session(req),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = MFAController
|
||||
|
||||
Reference in New Issue
Block a user