Expand activity tracking and add PasswordResetAlert job
This commit is contained in:
@@ -3,7 +3,7 @@ const zxcvbn = require('zxcvbn')
|
||||
|
||||
class PasswordController extends Controller {
|
||||
static get services() {
|
||||
return [...super.services, 'auth', 'jobs', 'models']
|
||||
return [...super.services, 'auth', 'jobs', 'models', 'activity']
|
||||
}
|
||||
|
||||
async get_resets(req, res, next) {
|
||||
@@ -35,6 +35,7 @@ class PasswordController extends Controller {
|
||||
|
||||
const { password, record } = await req.user.app_password(req.body.name)
|
||||
await req.user.save()
|
||||
await this.activity.app_password_created({ req, name: req.body.name })
|
||||
|
||||
return res.api({
|
||||
password,
|
||||
@@ -86,6 +87,7 @@ class PasswordController extends Controller {
|
||||
// Create the password reset
|
||||
const reset = await req.user.reset_password(req.body.password)
|
||||
await req.user.save()
|
||||
await this.activity.password_reset({ req, ip: req.ip })
|
||||
if ( req.trap.has_trap() && req.trap.get_trap() === 'password_reset' ) await req.trap.end()
|
||||
|
||||
// invalidate existing tokens and other logins
|
||||
|
||||
Reference in New Issue
Block a user