|
|
|
@ -2,7 +2,8 @@
|
|
|
|
|
|
|
|
|
|
var async = require('async'),
|
|
|
|
|
db = require('../database'),
|
|
|
|
|
meta = require('../meta');
|
|
|
|
|
meta = require('../meta'),
|
|
|
|
|
events = require('../events');
|
|
|
|
|
|
|
|
|
|
module.exports = function(User) {
|
|
|
|
|
User.auth = {};
|
|
|
|
@ -28,8 +29,12 @@ module.exports = function(User) {
|
|
|
|
|
if (err) {
|
|
|
|
|
return callback(err);
|
|
|
|
|
}
|
|
|
|
|
var duration = 1000 * 60 * (meta.config.lockoutDuration || 60);
|
|
|
|
|
|
|
|
|
|
db.delete('loginAttempts:' + uid);
|
|
|
|
|
db.pexpire('lockout:' + uid, 1000 * 60 * (meta.config.lockoutDuration || 60));
|
|
|
|
|
db.pexpire('lockout:' + uid, duration);
|
|
|
|
|
|
|
|
|
|
events.logAccountLock(uid, duration);
|
|
|
|
|
callback(new Error('account-locked'));
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|