Logging around accoung lock/unlocking

This commit is contained in:
Bryan Ashby 2018-11-23 11:44:46 -07:00
parent f0e7b46a2f
commit a4823c0c4a
3 changed files with 11 additions and 3 deletions

View file

@ -152,6 +152,7 @@ module.exports = class User {
if(!_.has(tempUser.properties, UserProps.AccountLockedPrevStatus)) {
props[UserProps.AccountLockedPrevStatus] = tempUser.getProperty(UserProps.AccountStatus);
}
Log.info( { userId, failedAttempts }, '(Re)setting account to locked due to failed logins');
return tempUser.persistProperties(props, callback);
}
@ -243,6 +244,10 @@ module.exports = class User {
const minutesSinceLocked = moment().diff(lockedTs, 'minutes');
if(minutesSinceLocked >= autoUnlockMinutes) {
// allow the login - we will clear any lock there
Log.info(
{ username, userId : tempAuthInfo.userId, lockedAt : lockedTs.format() },
'Locked account will now be unlocked due to auto-unlock minutes policy'
);
return callback(null);
}
}