Add account unlock on password reset (#7146)
* added account unlock on password reset * added account policy option * added changelog entry * Added docs entry * moved changelog entry to correct position * improved tests to ensure requesting password reset email does not unlock account * run prettier
This commit is contained in:
@@ -158,6 +158,23 @@ export class AccountLockout {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the account lockout.
|
||||
*/
|
||||
unlockAccount() {
|
||||
if (!this._config.accountLockout || !this._config.accountLockout.unlockOnPasswordReset) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return this._config.database.update(
|
||||
'_User',
|
||||
{ username: this._user.username },
|
||||
{
|
||||
_failed_login_count: { __op: 'Delete' },
|
||||
_account_lockout_expires_at: { __op: 'Delete' },
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default AccountLockout;
|
||||
|
||||
Reference in New Issue
Block a user