diff --git a/server/controllers/user.controller.js b/server/controllers/user.controller.js index d552e648..f06c3d99 100644 --- a/server/controllers/user.controller.js +++ b/server/controllers/user.controller.js @@ -46,7 +46,7 @@ export function createUser(req, res, next) { const EMAIL_VERIFY_TOKEN_EXPIRY_TIME = Date.now() + (3600000 * 24); // 24 hours random((tokenError, token) => { const user = new User({ - username: username, + username, email: emailLowerCase, password, verified: User.EmailConfirmation.Sent, diff --git a/server/models/user.js b/server/models/user.js index d5e5d8f6..321c2231 100644 --- a/server/models/user.js +++ b/server/models/user.js @@ -147,7 +147,7 @@ userSchema.statics.findByMailOrName = function findByMailOrName(email) { $or: [{ email: new RegExp(`^${escapeStringRegexp(email)}$`, 'i'), }, { - username: new RegExp(`^${escapeStringRegexp(email)}$`, 'i'), + username: new RegExp(`^${escapeStringRegexp(email)}$`, 'i'), }], }; return this.findOne(query).exec();