Improve: Remove uncessary RegExp query by email (#17654)

pull/17695/head
Rodrigo Nascimento 6 years ago committed by GitHub
parent 7aabfa4ae5
commit bbb31339a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/models/server/models/Users.js
  2. 2
      server/methods/registerUser.js

@ -523,7 +523,7 @@ export class Users extends Base {
}
findOneByEmailAddress(emailAddress, options) {
const query = { 'emails.address': new RegExp(`^${ s.escapeRegExp(emailAddress) }$`, 'i') };
const query = { 'emails.address': String(emailAddress).trim().toLowerCase() };
return this.findOne(query, options);
}

@ -62,7 +62,7 @@ Meteor.methods({
};
// Check if user has already been imported and never logged in. If so, set password and let it through
const importedUser = Users.findOneByEmailAddress(s.trim(formData.email.toLowerCase()));
const importedUser = Users.findOneByEmailAddress(formData.email);
let userId;
if (importedUser && importedUser.importIds && importedUser.importIds.length && !importedUser.lastLogin) {
Accounts.setPassword(importedUser._id, userData.password);

Loading…
Cancel
Save