fix password validate crash

pull/9297/head
Mrugesh Mohapatra 2016-06-23 00:55:15 +05:30
parent 0ab01fc7d1
commit 546737e6be
2 changed files with 10 additions and 0 deletions

View File

@ -80,6 +80,11 @@ module.exports = function(User) {
if (user.progressTimestamps.length === 0) {
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();
});

View File

@ -53,6 +53,11 @@ module.exports = function(app) {
User.beforeRemote('create', function(ctx, user, next) {
var body = ctx.req.body;
if (body) {
// this is workaround for preventing a server crash
// refer strongloop/loopback/#1364
if (body.password === '') {
body.password = null;
}
body.emailVerified = false;
}
next();