Fix isEmail validation failure on valid emails during Docker setup (#835)
This commit is contained in:
parent
2ce1c62c48
commit
5a1f0650ae
3 changed files with 8 additions and 2 deletions
|
|
@ -11,12 +11,13 @@ const _ = require('lodash');
|
|||
* @returns {Promise<{user: User, created: boolean}>} User object and creation status
|
||||
*/
|
||||
async function createOrUpdateUser(email, password) {
|
||||
const normalizedEmail = email.trim().toLowerCase();
|
||||
const hashedPassword = await bcrypt.hash(password, 10);
|
||||
|
||||
const [user, created] = await User.findOrCreate({
|
||||
where: { email },
|
||||
where: { email: normalizedEmail },
|
||||
defaults: {
|
||||
email,
|
||||
email: normalizedEmail,
|
||||
password_digest: hashedPassword,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue