diff --git a/common/models/user.js b/common/models/user.js index c318a88b94..06761e0209 100644 --- a/common/models/user.js +++ b/common/models/user.js @@ -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;