Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
butlerx committed Dec 28, 2017
1 parent 4d4e64a commit ffce999
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
39 changes: 20 additions & 19 deletions lib/users/unlock-account-email.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
'use strict';
var async = require('async');
var _ = require('lodash');
var protocol = process.env.PROTOCOL || 'http';
var zenHostname = process.env.HOSTNAME || '127.0.0.1:8000';
const moment = require('moment');
const options = require('../../config/config');

function unlockAccountEmail (args, cb) {
var seneca = this;
var email = args.email;
var locality = args.locality || 'en_US';
var emailCode = 'user-lockout-';
var emailSubject = 'CoderDojo Zen Account Lockout';
const protocol = process.env.PROTOCOL || 'http';
const zenHostname = process.env.HOSTNAME || '127.0.0.1:8000';

seneca.act({role: 'cd-users', cmd: 'get_users_by_email', email: email}, function (err, users) {
function unlockAccountEmail(args, done) {
const seneca = this;
const email = args.email;

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: emailCode,
locality: locality,
seneca.act({ role: 'email-notifications', cmd: 'send' }, {
code: 'user-lockout-',
locality: args.locality || 'en_US',
to: email,
subject: emailSubject,
content: {name: users[0].name, resetlink: protocol + '://' + zenHostname + '/reset_password', year: moment(new Date()).format('YYYY')}
}, function (err, response) {
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});
return done(null, { ok: false });
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"seneca-mail": "^0.2.2",
"seneca-postgresql-store": "2.3",
"seneca-store-query": "0.0.5",
"seneca-user": "2.0.0",
"seneca-user": "2.1.1",
"shortid": "2.2.2",
"util": "^0.10.3",
"xoauth2": "1.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ DO $$
BEGIN
ALTER TABLE sys_user ADD COLUMN failed_login_count integer;
EXCEPTION
WHEN duplicate_column THEN RAISE NOTICE 'column token already exists in sys_user.';
WHEN duplicate_column THEN RAISE NOTICE 'column failed_login_count already exists in sys_user.';
END;
END;
$$

0 comments on commit ffce999

Please sign in to comment.