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

Commit 2f7aeaa

Browse files
merged latest master in
2 parents fa8a729 + f927306 commit 2f7aeaa

29 files changed

+489
-129
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';

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"cheerio": "^1.0.0-rc.2",
5757
"compression": "~1.7.1",
5858
"cors": "~2.8.4",
59+
"cross-env": "^5.1.4",
5960
"crypto": "~1.0.1",
6061
"crypto-js": "^3.1.9-1",
6162
"dauria": "~2.0.0",

server/authentication.js

Lines changed: 15 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,11 +18,25 @@ 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: [
2325
authentication.hooks.authenticate('jwt')
2426
]
2527
}
2628
});
29+
30+
app.on('login', (result, meta) => {
31+
try {
32+
if (meta.connection && meta.connection.user) {
33+
// update last active timestamp on loggedin user
34+
app.service('users').patch(meta.connection.user, {
35+
lastActiveAt: new Date()
36+
});
37+
}
38+
} catch (err) {
39+
app.error(err);
40+
}
41+
});
2742
};

server/helper/get-unique-slug.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
1-
const getUniqueSlug = (service, slug, count) => {
1+
const getUniqueSlug = (service, slug, count, id) => {
22
return new Promise(resolve => {
3-
const testslug = count?slug+count:slug;
3+
const testSlug = count ? slug + count : slug;
44

55
// Test if we already have data with this slug
6+
const query = {
7+
slug: testSlug
8+
};
9+
// ignore entry with given id (if set)
10+
if (id) {
11+
query._id = {
12+
$ne: id
13+
};
14+
}
615
service.find({
7-
query: {
8-
slug: testslug
9-
}
16+
query
1017
}).then((result) => {
11-
if(result.data.length > 0) {
12-
count = count?count+1:1;
18+
if (result.data.length > 0) {
19+
count = count ? count + 1 : 1;
1320
resolve(getUniqueSlug(service, slug, count));
1421
} else {
15-
resolve(testslug);
22+
resolve(testSlug);
1623
}
1724
});
1825
});
1926
};
2027

21-
module.exports = getUniqueSlug;
28+
module.exports = getUniqueSlug;

server/hooks/create-excerpt.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,14 @@ module.exports = function (options = {}) { // eslint-disable-line no-unused-vars
2121
try {
2222
/* eslint no-use-before-define: 0 */ // --> OFF
2323
const content = sanitizeHtml(hook.data[options.field], sanitizeOptions)
24-
.replace(/\<br\>|\<\/br\>|\<\/ br\>|\<br\>|\<br\\\>/ig, "\n")
25-
.replace(/\<p\>\<br\>\<\/p\>/ig, ' ')
24+
.replace(/\<br\s*\>|\<br\s*\/\>/ig, "\n")
2625
.replace(/(\ ){2,}/ig, ' ')
2726
.trim();
2827
hook.data[`${options.field}Excerpt`] = trunc(content, options.length, {
2928
ignoreTags: ['img', 'script', 'iframe']
3029
}).html;
3130
} catch (err) {
32-
if (hook.data.teaserImg) {
33-
hook.data[`${options.field}Excerpt`] = '-----';
34-
} else {
35-
throw new Error('Text content needed!');
36-
}
31+
throw new Error('Text content needed!');
3732
}
3833
hook.data[options.field] = hook.data[options.field]
3934
.replace(/(\ ){2,}/ig, ' ')

0 commit comments

Comments
 (0)