fix password validate crash
parent
0ab01fc7d1
commit
546737e6be
|
@ -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();
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue