Lowercase email on local auth register

This commit is contained in:
Anshul Kushwaha 2018-07-13 20:29:41 +05:30 committed by GitHub
parent 02129dc1d8
commit 18e8d69775
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -256,11 +256,11 @@ module.exports = {
return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.role.notFound' }] }] : 'Impossible to find the root role.');
}
// Check if the provided identifier is an email or not.
const isEmail = emailRegExp.test(params.identifier);
// Check if the provided email is valid or not.
const isEmail = emailRegExp.test(params.email);
if (isEmail) {
params.identifier = params.identifier.toLowerCase();
params.email = params.email.toLowerCase();
}
params.role = role._id || role.id;