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

Commit 451d625

Browse files
committed
Add support for account, \n add db migration for userlockout \n add email asking user to reset when account lockout
1 parent 95e0741 commit 451d625

File tree

7 files changed

+75
-78
lines changed

7 files changed

+75
-78
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<% include ../common-en_US/header.ejs %>
2+
3+
<h1>Hi <%=name%>,</h1>
4+
5+
<p>We have noticed multiple failed attempts to login to your zen account so for security reasons have locked your account. </p>
6+
7+
<p>To unlock your account you will need to change your password.</p>
8+
<p>Please follow the link below to reset your password.</br>
9+
<a href="<%=resetlink%>"><%=resetlink%></a></p>
10+
11+
12+
<p>Best wishes,</br>
13+
The CoderDojo Foundation Team</p>
14+
15+
<% include ../common-en_US/footer.ejs %>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Hi <%=name%>;
2+
3+
We have noticed multiple failed attempts to login to your zen account so for security reasons have locked your account.
4+
5+
To unlock your account you will need to change your password.
6+
Please follow the link below to reset your password.
7+
<%=resetlink%>
8+
9+
Best wishes,
10+
The CoderDojo Foundation Team

lib/users/unlock-account-email.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
'use strict';
2+
var async = require('async');
3+
var _ = require('lodash');
4+
var protocol = process.env.PROTOCOL || 'http';
5+
var zenHostname = process.env.HOSTNAME || '127.0.0.1:8000';
6+
7+
function unlockAccountEmail (args, cb) {
8+
var seneca = this;
9+
var email = args.email;
10+
var locality = args.locality || 'en_US';
11+
var emailCode = 'user-lockout-';
12+
var emailSubject = 'CoderDojo Zen Account Lockout';
13+
14+
seneca.act({role: 'cd-users', cmd: 'get_users_by_email', email: email}, function (err, users) {
15+
if (err) return done(err);
16+
if (options['email-notifications'].sendemail) {
17+
seneca.act({role: 'email-notifications', cmd: 'send'}, {
18+
code: emailCode,
19+
locality: locality,
20+
to: email,
21+
subject: emailSubject,
22+
content: {name: users[0].name, resetlink: protocol + '://' + zenHostname + '/reset_password', year: moment(new Date()).format('YYYY')}
23+
}, function (err, response) {
24+
if (err) return done(err);
25+
return done(null, { ok: true });
26+
});
27+
} else {
28+
return done(null, {ok: false});
29+
}
30+
});
31+
}

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
"po2json": "0.4.2",
4242
"postgrator": "2.2.0",
4343
"request": "2.58.0",
44-
"seneca": "0.7.2",
45-
"seneca-auth": "0.2.10",
44+
"seneca": "1.4.0",
45+
"seneca-auth": "1.0.0",
4646
"seneca-mail": "0.2.1",
4747
"seneca-postgresql-store": "1.1.3",
48-
"seneca-user": "0.2.10",
48+
"seneca-user": "1.0.0",
4949
"cp-permissions-plugin": "git://github.com/CoderDojo/cp-permissions-plugin#0.0.1",
5050
"shortid": "2.2.2",
5151
"xoauth2": "1.1.0"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
DO $$
2+
BEGIN
3+
BEGIN
4+
ALTER TABLE sys_user ADD COLUMN lock_try integer;
5+
EXCEPTION
6+
WHEN duplicate_column THEN RAISE NOTICE 'column token already exists in sys_user.';
7+
END;
8+
END;
9+
$$

users.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ module.exports = function (options) {
3232
seneca.add({role: plugin, cmd: 'kpi_number_of_youths_registered'}, cmd_kpi_number_of_youths_registered);
3333
seneca.add({role: plugin, cmd: 'kpi_number_of_champions_and_mentors_registered'}, cmd_kpi_number_of_champions_and_mentors_registered);
3434
seneca.add({role: plugin, cmd: 'kpi_number_of_youth_females_registered'}, cmd_kpi_number_of_youth_females_registered);
35-
seneca.add({role: 'cd-users', cmd: 'is_self'}, require('./lib/users/is-self'));
36-
seneca.add({role: 'cd-users', cmd: 'is_parent_of'}, require('./lib/users/is-parent-of'));
35+
seneca.add({role: plugin, cmd: 'is_self'}, require('./lib/users/is-self'));
36+
seneca.add({role: plugin, cmd: 'is_parent_of'}, require('./lib/users/is-parent-of'));
37+
seneca.add({role: plugin, cmd: 'unlock_account_email'}, require('./lib/users/unlock-account-email'));
3738

3839
function cmd_load_prev_founder (args, done) {
3940
var seneca = this;

web/locale/en_US/messages.po

Lines changed: 4 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,6 @@ msgstr "All Dojos are independent, autonomous, community groups set up to inspir
498498
msgid "We commit to inspiring and supporting young people to learn how to create technology"
499499
msgstr "We commit to inspiring and supporting young people to learn how to create technology"
500500

501-
msgid "We commit to inspiring and supporting young people to learn how to create technology"
502-
msgstr "We commit to inspiring and supporting young people to learn how to create technology"
503-
504501
msgid "We commit to the highest possible standards of child protection in our jurisdiction"
505502
msgstr "We commit to the highest possible standards of child protection in our jurisdiction"
506503

@@ -597,9 +594,6 @@ msgstr "Next"
597594
msgid "Dojo Menu"
598595
msgstr "Dojo Menu"
599596

600-
msgid "Events"
601-
msgstr "Events"
602-
603597
msgid "Forum"
604598
msgstr "Forum"
605599

@@ -669,9 +663,6 @@ msgstr "Send Request"
669663
msgid "Contact"
670664
msgstr "Contact"
671665

672-
msgid "Email"
673-
msgstr "Email"
674-
675666
msgid "Dojo Email"
676667
msgstr "Dojo Email"
677668

@@ -882,9 +873,6 @@ msgstr "unverified"
882873
msgid "Stage"
883874
msgstr "Stage"
884875

885-
msgid "Dojo Email"
886-
msgstr "Dojo Email"
887-
888876
msgid "User Email"
889877
msgstr "User Email"
890878

@@ -957,15 +945,9 @@ msgstr "You must be over 18 years old..."
957945
msgid "Please include country code..."
958946
msgstr "Please include country code..."
959947

960-
msgid "Address"
961-
msgstr "Address"
962-
963948
msgid "Enter your street level address..."
964949
msgstr "Enter your street level address..."
965950

966-
msgid "Address is empty"
967-
msgstr "Address is empty"
968-
969951
msgid "Technical Experience"
970952
msgstr "Technical Experience"
971953

@@ -1242,9 +1224,6 @@ msgstr "Newspaper/Magazine"
12421224
msgid "Radio"
12431225
msgstr "Radio"
12441226

1245-
msgid "Family/Friends"
1246-
msgstr "Family/Friends"
1247-
12481227
msgid "Error loading profile"
12491228
msgstr "Error loading profile:"
12501229

@@ -1323,9 +1302,6 @@ msgstr "Type"
13231302
msgid "For"
13241303
msgstr "For"
13251304

1326-
msgid "Name"
1327-
msgstr "Name"
1328-
13291305
msgid "Capacity"
13301306
msgstr "Capacity"
13311307

@@ -1707,9 +1683,6 @@ msgstr "Add Youth over 13"
17071683
msgid "This profile is private"
17081684
msgstr "This profile is private"
17091685

1710-
msgid "We need mentors!"
1711-
msgstr "We need mentors!"
1712-
17131686
msgid "Find out more about becoming a CoderDojo mentor"
17141687
msgstr "Find out more about becoming a CoderDojo mentor"
17151688

@@ -1743,15 +1716,9 @@ msgstr "An error has occured verifying the charter agreement."
17431716
msgid "error.general"
17441717
msgstr "There was an error on this page. Our technical staff have been notified"
17451718

1746-
msgid "Gather your Team"
1747-
msgstr "Gather your Team"
1748-
17491719
msgid "Find a Venue"
17501720
msgstr "Find a Venue"
17511721

1752-
msgid "Plan your Dojo"
1753-
msgstr "Plan your Dojo"
1754-
17551722
msgid "Promote your Dojo"
17561723
msgstr "Promote your Dojo"
17571724

@@ -1866,15 +1833,9 @@ msgstr "Optionally describe how this was achieved."
18661833
msgid "Data Protection: Our Dojo only uses data provided for the intended purpose. abides by data protection regulations in our jurisdiction."
18671834
msgstr "Data Protection: Our Dojo only uses data provided for the intended purpose. abides by data protection regulations in our jurisdiction."
18681835

1869-
msgid "Optionally describe how this was achieved."
1870-
msgstr "Optionally describe how this was achieved."
1871-
18721836
msgid "Diversity among our attendees is respected"
18731837
msgstr "Diversity among our attendees is respected"
18741838

1875-
msgid "Optionally describe how this was achieved."
1876-
msgstr "Optionally describe how this was achieved."
1877-
18781839
msgid "We will work to help engage with and improve the greater CoderDojo movement by"
18791840
msgstr "We will work to help engage with and improve the greater CoderDojo movement by"
18801841

@@ -1887,9 +1848,6 @@ msgstr "Contributing to Kata, the community knowledge base at kata.coderdojo.com
18871848
msgid "Connecting with local and international Dojos to share insights and supports"
18881849
msgstr "Connecting with local and international Dojos to share insights and supports"
18891850

1890-
msgid "Optionally describe how this was achieved."
1891-
msgstr "Optionally describe how this was achieved."
1892-
18931851
msgid "Admin permissions cannot be removed from a Dojo owner."
18941852
msgstr "Admin permissions cannot be removed from a Dojo owner."
18951853

@@ -2089,15 +2047,6 @@ msgstr "Invitation was sent successfully."
20892047
msgid "An error has occurred while sending invitation"
20902048
msgstr "An error has occurred while sending invitation"
20912049

2092-
msgid "We will work to embody the CoderDojo ethos"
2093-
msgstr "We will work to embody the CoderDojo ethos"
2094-
2095-
msgid "All mentors and young people are aware of online safety best practices and we only allow age appropriate content at our Dojo"
2096-
msgstr "All mentors and young people are aware of online safety best practices and we only allow age appropriate content at our Dojo"
2097-
2098-
msgid "Optionally describe how this was achieved."
2099-
msgstr "Optionally describe how this was achieved."
2100-
21012050
msgid "Our Dojo abides by data protection regulations in our jurisdiction"
21022051
msgstr "Our Dojo abides by data protection regulations in our jurisdiction"
21032052

@@ -2107,15 +2056,6 @@ msgstr "Inclusion is a fundamental principle of CoderDojo, <a href=\"http://kata
21072056
msgid "Our Dojo will work to engage with and improve the greater CoderDojo movement by:"
21082057
msgstr "Our Dojo will work to engage with and improve the greater CoderDojo movement by:"
21092058

2110-
msgid "Communicating with the CoderDojo Foundation"
2111-
msgstr "Communicating with the CoderDojo Foundation"
2112-
2113-
msgid "Contributing to Kata, the community knowledge base at kata.coderdojo.com"
2114-
msgstr "Contributing to Kata, the community knowledge base at kata.coderdojo.com"
2115-
2116-
msgid "Connecting with local and international Dojos to share insights and supports"
2117-
msgstr "Connecting with local and international Dojos to share insights and supports"
2118-
21192059
msgid "This dojo has no coordinates."
21202060
msgstr "This dojo has no coordinates."
21212061

@@ -2128,6 +2068,9 @@ msgstr "You have been invited to register as a parent/guardian on Zen, the Coder
21282068
msgid "CoderDojo Zen Password Reset Request"
21292069
msgstr "CoderDojo Zen Password Reset Request"
21302070

2071+
msgid "CoderDojo Zen Account Lockout"
2072+
msgstr "CoderDojo Zen Account Lockout"
2073+
21312074
msgid "You have been invited to connect with a parent/guardian on Zen!"
21322075
msgstr "You have been invited to connect with a parent/guardian on Zen!"
21332076

@@ -2179,9 +2122,6 @@ msgstr "Welcome New CoderDojo Champion!"
21792122
msgid "The first step towards setting up a Dojo in your area is filling out the form below and giving us a little more information about yourself."
21802123
msgstr "The first step towards setting up a Dojo in your area is filling out the form below and giving us a little more information about yourself."
21812124

2182-
msgid "The purpose of us gathering this information is so we can tailor support to you as your start your Dojo journey!"
2183-
msgstr "The purpose of us gathering this information is so we can tailor support to you as your start your Dojo journey!"
2184-
21852125
msgid "If you wish to learn more about the process of starting a CoderDojo in your area before completing this form please see Kata, the CoderDojo Community Knowledge Base."
21862126
msgstr "If you wish to learn more about the process of starting a CoderDojo in your area before completing this form please see Kata, the CoderDojo Community Knowledge Base."
21872127

@@ -2302,9 +2242,6 @@ msgstr "Parent profile does not exist."
23022242
msgid "You have a Dojo application awaiting verification. You can create another Dojo after it has been verified."
23032243
msgstr "You have a Dojo application awaiting verification. You can create another Dojo after it has been verified."
23042244

2305-
msgid "No Dojos match your search query."
2306-
msgstr "No Dojos match your search query."
2307-
23082245
msgid "Please let us know how you heard about CoderDojo"
23092246
msgstr "Please let us know how you heard about CoderDojo"
23102247

@@ -2578,9 +2515,6 @@ msgstr "My Events"
25782515
msgid "Review Champion Application"
25792516
msgstr "Review Champion Application"
25802517

2581-
msgid "Manage Dojo Users"
2582-
msgstr "Manage Dojo Users"
2583-
25842518
msgid "Setup Dojo"
25852519
msgstr "Setup Dojo"
25862520

@@ -3003,9 +2937,6 @@ msgstr "Changes to our Privacy Statement"
30032937
msgid "Any changes to this Privacy Statement will be posted on the Website so you are always aware of what information we collect, how we use it, and under what circumstances, if any, we disclose it. If at any time we decide to use personal data in a manner significantly different from that stated in this Privacy Statement, or otherwise disclosed to you at the time it was collected, we will notify you by email, and you will have a choice as to whether or not we use your information in the new manner."
30042938
msgstr "Any changes to this Privacy Statement will be posted on the Website so you are always aware of what information we collect, how we use it, and under what circumstances, if any, we disclose it. If at any time we decide to use personal data in a manner significantly different from that stated in this Privacy Statement, or otherwise disclosed to you at the time it was collected, we will notify you by email, and you will have a choice as to whether or not we use your information in the new manner."
30052939

3006-
msgid "Contact"
3007-
msgstr "Contact"
3008-
30092940
msgid "We welcome any queries, comments or requests you may have regarding this Privacy Statement. Please contact us in writing at Dogpatch Labs, The CHQ Building, Custom House Quay, Dublin 1, IRELAND or by e-mail at info@coderdojo.com."
30102941
msgstr "We welcome any queries, comments or requests you may have regarding this Privacy Statement. Please contact us in writing at Dogpatch Labs, The CHQ Building, Custom House Quay, Dublin 1, IRELAND or by e-mail at info@coderdojo.com."
30112942

@@ -3052,4 +2983,4 @@ msgid "Are you sure you want to remove this child?"
30522983
msgstr "Are you sure you want to remove this child?"
30532984

30542985
msgid "A new dojo has been created"
3055-
msgstr "A new dojo has been created!"
2986+
msgstr "A new dojo has been created!"

0 commit comments

Comments
 (0)