diff --git a/lib/users/unlock-account-email.js b/lib/users/unlock-account-email.js index 9a9df5fd..81defc23 100644 --- a/lib/users/unlock-account-email.js +++ b/lib/users/unlock-account-email.js @@ -1,5 +1,4 @@ const moment = require('moment'); -const options = require('../../config/config'); const protocol = process.env.PROTOCOL || 'http'; const zenHostname = process.env.HOSTNAME || '127.0.0.1:8000'; @@ -10,24 +9,20 @@ function unlockAccountEmail(args, done) { seneca.act({ role: 'cd-users', cmd: 'get_users_by_email', email }, (err, users) => { if (err) return done(err); - if (options['email-notifications'].sendemail) { - seneca.act({ role: 'email-notifications', cmd: 'send' }, { - code: 'user-lockout-', - locality: args.locality || 'en_US', - to: email, - subject: 'CoderDojo Zen Account Lockout', - content: { - name: users[0].name, - resetlink: `${protocol}://${zenHostname}/reset_password`, - year: moment(new Date()).format('YYYY'), - }, - }, (err, response) => { - if (err) return done(err); - return done(null, { ok: true }); - }); - } else { - return done(null, { ok: false }); - } + seneca.act({ role: 'email-notifications', cmd: 'send' }, { + code: 'user-lockout-', + locality: args.locality || 'en_US', + to: email, + subject: 'CoderDojo Zen Account Lockout', + content: { + name: users[0].name, + resetlink: `${protocol}://${zenHostname}/reset_password`, + year: moment(new Date()).format('YYYY'), + }, + }, (err, response) => { + if (err) return done(err); + return done(null, { ok: true }); + }); }); } diff --git a/service.js b/service.js index d583dd39..e0037e7d 100644 --- a/service.js +++ b/service.js @@ -58,7 +58,7 @@ require('./migrate-psql-db.js')(function (err) { logger: log.logger }); seneca.use(require('./oauth2.js'), {clients: config.oauth2.clients}); - seneca.use('user', { failedCount: 3 }); + seneca.use('user', { failedLoginCount: 3 }); seneca.use('auth'); seneca.use(require('./users.js'), { 'email-notifications': config['email-notifications'],