Merge branch 'back' into 'master'
Fix register socket See merge request LETU/LETU!24
This commit is contained in:
commit
7a3be9242c
1 changed files with 12 additions and 9 deletions
|
@ -8,14 +8,17 @@ module.exports = socket => {
|
||||||
else if ((!data.email.endsWith("@univ-lyon1.fr")) && (!data.email.endsWith("@etu.univ-lyon1.fr")))
|
else if ((!data.email.endsWith("@univ-lyon1.fr")) && (!data.email.endsWith("@etu.univ-lyon1.fr")))
|
||||||
socket.emit("register", {error: {message: "invalid_email"}});
|
socket.emit("register", {error: {message: "invalid_email"}});
|
||||||
else {
|
else {
|
||||||
let user = await models.User.create({
|
try {
|
||||||
email: data.email,
|
let user = await models.User.create({
|
||||||
firstName: data.firstName,
|
email: data.email,
|
||||||
lastName: data.lastName,
|
firstName: data.firstName,
|
||||||
passwordHash: data.password
|
lastName: data.lastName,
|
||||||
});
|
passwordHash: data.password
|
||||||
|
});
|
||||||
await emailCheck(socket, user, null);
|
await emailCheck(socket, user, null);
|
||||||
|
} catch (Exception) {
|
||||||
|
socket.emit("register", {error: {message: "invalid_email"}})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Reference in a new issue