fix email login not case sensitive

pull/2726/head
Berkeley Martinez 2015-08-25 22:27:01 -07:00
parent e786a258ff
commit df3918cc53
1 changed files with 8 additions and 0 deletions

View File

@ -123,6 +123,14 @@ module.exports = function(User) {
});
});
User.beforeRemote('login', function(ctx, notUsed, next) {
const { body } = ctx.req;
if (body && typeof body.email === 'string') {
body.email = body.email.toLowerCase();
}
next();
});
User.afterRemote('login', function(ctx, accessToken, next) {
var res = ctx.res;
var req = ctx.req;