Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.

Commit 171b90b

Browse files
Merge pull request #57 from Human-Connection/master
Merge Master into Develop
2 parents a7318ac + f927306 commit 171b90b

File tree

14 files changed

+223
-38
lines changed

14 files changed

+223
-38
lines changed

config/local.example.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,9 @@
44
"baseURL": "http://localhost:3030",
55
"frontURL": "http://localhost:3000",
66
"smtpConfig": {
7-
"host": "localhost",
7+
"host": "0.0.0.0",
88
"port": 1025,
9-
"secure": false,
10-
"ignoreTLS": true,
11-
"auth": {
12-
"user": "",
13-
"pass": ""
14-
}
9+
"ignoreTLS": true
1510
},
1611
"thumbor": {
1712
"url": "",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
@import '../../layout/common';
1+
@import '../../../layout/common';
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
@import '../../layout/common';
1+
@import '../../../layout/common';

email-templates/account/reset-password/de/html.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
</tr>
2121
<tr>
2222
<td class="aligncenter content-block">
23-
Wenn du diese Nachricht ignorierst bleibt dein passwort wie es ist.
23+
Wenn du diese Nachricht ignorierst, bleibt dein Passwort wie es ist.
2424
</td>
2525
</tr>
2626
<tr>
2727
<td class="aligncenter content-block" itemprop="handler" itemscope itemtype="http://schema.org/HttpActionHandler">
28-
Wenn du es nicht warst der dein Passwort zurücksetzen wollte <a href='mailto:{{returnEmail}}?subject=I did not reset my password&body=Someone unauthorized sent this reset password request.'>lass es uns wissen!</a>
28+
Wenn du es nicht warst, der dein Passwort zurücksetzen wollte, <a href='mailto:{{returnEmail}}?subject=I did not reset my password&body=Someone unauthorized sent this reset password request.'>lass es uns wissen!</a>
2929
</td>
3030
</tr>
3131
<tr>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
@import '../../layout/common';
1+
@import '../../../layout/common';
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
@import '../../layout/common';
1+
@import '../../../layout/common';

server/authentication.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const authentication = require('feathers-authentication');
22
const jwt = require('feathers-authentication-jwt');
33
const local = require('feathers-authentication-local');
4+
const { lowerCase } = require('feathers-hooks-common');
45

56
module.exports = function () {
67
const app = this;
@@ -17,6 +18,7 @@ module.exports = function () {
1718
app.service('authentication').hooks({
1819
before: {
1920
create: [
21+
lowerCase('email', 'username'),
2022
authentication.hooks.authenticate(config.strategies)
2123
],
2224
remove: [

server/hooks/xss.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ function clean (dirty) {
2424
dirty = sanitizeHtml(dirty, {
2525
allowedTags: ['iframe', 'img', 'p', 'br', 'b', 'i', 'em', 'strong', 'a', 'pre', 'ul', 'li', 'ol', 's', 'strike', 'span', 'blockquote'],
2626
allowedAttributes: {
27-
a: ['href', 'class', 'target', 'data-*'],
28-
img: [ 'src' ],
27+
a: ['href', 'class', 'target', 'data-*' , 'contenteditable'],
28+
span: ['contenteditable'],
29+
img: ['src'],
2930
iframe: ['src', 'class', 'frameborder', 'allowfullscreen']
3031
},
3132
allowedIframeHostnames: ['www.youtube.com', 'player.vimeo.com'],

server/services/auth-management/auth-management.hooks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const isEnabled = require('../../hooks/is-enabled');
22
const { authenticate } = require('feathers-authentication').hooks;
3-
const commonHooks = require('feathers-hooks-common');
3+
const { iff } = require('feathers-hooks-common');
44

55
const isAction = () => {
66
let args = Array.from(arguments);
@@ -13,7 +13,7 @@ module.exports = {
1313
find: [],
1414
get: [],
1515
create: [
16-
commonHooks.iff(
16+
iff(
1717
isAction('passwordChange', 'identityChange'),
1818
[
1919
authenticate('jwt'),

server/services/auth-management/notifier.js

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,33 @@ module.exports = function (app) {
3737
)
3838
);
3939

40+
let language = user.userSettings ? user.userSettings.uiLanguage : user.language || 'en';
41+
4042
const templatePath = path.join(
4143
__dirname,
4244
'../../../email-templates/account',
4345
templatename,
44-
user.language || 'en'
46+
language
4547
);
4648

47-
const hashLink = getLink(linktype, user.verifyToken || null);
49+
let token;
50+
51+
switch (linktype) {
52+
case 'invite-email':
53+
token = user.verifyToken;
54+
break;
55+
case 'verify':
56+
token = user.verifyToken;
57+
break;
58+
case 'reset':
59+
token = user.resetToken;
60+
break;
61+
case 'verifyChanges':
62+
token = user.changeToken;
63+
break;
64+
}
65+
66+
const hashLink = getLink(linktype, token || null);
4867
const frontURL = app.get('frontURL');
4968
const backURL = app.get('baseURL');
5069

@@ -62,7 +81,7 @@ module.exports = function (app) {
6281
name: user.name || user.email,
6382
email: user.email,
6483
code: user.code || null,
65-
language: user.language || 'en',
84+
language: language,
6685
link: hashLink,
6786
returnEmail: returnEmail,
6887
frontURL,
@@ -95,9 +114,7 @@ module.exports = function (app) {
95114
if (app.get('debug')) {
96115
const filename = String(Date.now()) + '.html';
97116
const filepath = path.join(__dirname, '../../../tmp/emails/', filename);
98-
fs.outputFile(filepath, email.html).catch(err => {
99-
app.error('Error saving email', err);
100-
});
117+
fs.outputFileSync(filepath, email.html);
101118
}
102119

103120
return app
@@ -124,23 +141,31 @@ module.exports = function (app) {
124141
user
125142
);
126143
case 'resendVerifySignup':
127-
return buildEmail('verify-email', 'Confirm signup', 'verify', user);
144+
return buildEmail(
145+
'verify-email',
146+
'Confirm signup',
147+
'verify',
148+
user);
128149
case 'verifySignup':
129150
return buildEmail(
130151
'email-verified',
131152
'Email address verified',
132153
'verify',
133154
user
134155
);
135-
case 'resetPwd':
136-
return buildEmail('reset-password', 'Password reset', 'reset', user);
137156
case 'sendResetPwd':
138157
return buildEmail(
139-
'password-was-reset',
140-
'Your password was reset',
158+
'reset-password',
159+
'Password reset',
141160
'reset',
142161
user
143162
);
163+
case 'resetPwd':
164+
return buildEmail(
165+
'password-reset',
166+
'Your password was reset',
167+
'reset',
168+
user);
144169
case 'passwordChange':
145170
return buildEmail(
146171
'password-change',

0 commit comments

Comments
 (0)