Expand activity tracking and add PasswordResetAlert job

This commit is contained in:
garrettmills
2020-07-13 09:35:11 -05:00
parent d29e6f057a
commit 143fccf179
7 changed files with 136 additions and 15 deletions

View File

@@ -638,6 +638,7 @@ class AuthController extends Controller {
const token = req.user.mfa_token
const codes = await token.generate_recovery()
await req.user.save()
await this.activity.mfa_recovery_created({ req })
return res.api({
codes,
})
@@ -704,6 +705,8 @@ class AuthController extends Controller {
req.user.mfa_enable_date = new Date
req.user.save()
await this.activity.mfa_enable({ req })
// invalidate existing tokens and other logins
const flitter = await this.auth.get_provider('flitter')
await flitter.logout(req)
@@ -724,6 +727,8 @@ class AuthController extends Controller {
req.user.app_passwords = []
await req.user.save()
await this.activity.mfa_disable({ req })
// invalidate existing login tokens and logins
const flitter = await this.auth.get_provider('flitter')
await flitter.logout(req)