fix password validate crash
This commit is contained in:
@ -80,6 +80,11 @@ module.exports = function(User) {
|
|||||||
if (user.progressTimestamps.length === 0) {
|
if (user.progressTimestamps.length === 0) {
|
||||||
user.progressTimestamps.push({ timestamp: Date.now() });
|
user.progressTimestamps.push({ timestamp: Date.now() });
|
||||||
}
|
}
|
||||||
|
// this is workaround for preventing a server crash
|
||||||
|
// refer strongloop/loopback/#1364
|
||||||
|
if (user.password === '') {
|
||||||
|
user.password = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return next();
|
return next();
|
||||||
});
|
});
|
||||||
|
@ -53,6 +53,11 @@ module.exports = function(app) {
|
|||||||
User.beforeRemote('create', function(ctx, user, next) {
|
User.beforeRemote('create', function(ctx, user, next) {
|
||||||
var body = ctx.req.body;
|
var body = ctx.req.body;
|
||||||
if (body) {
|
if (body) {
|
||||||
|
// this is workaround for preventing a server crash
|
||||||
|
// refer strongloop/loopback/#1364
|
||||||
|
if (body.password === '') {
|
||||||
|
body.password = null;
|
||||||
|
}
|
||||||
body.emailVerified = false;
|
body.emailVerified = false;
|
||||||
}
|
}
|
||||||
next();
|
next();
|
||||||
|
Reference in New Issue
Block a user