Fix register socket
This commit is contained in:
parent
47c557fb7c
commit
b3b94bacca
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")))
|
||||
socket.emit("register", {error: {message: "invalid_email"}});
|
||||
else {
|
||||
try {
|
||||
let user = await models.User.create({
|
||||
email: data.email,
|
||||
firstName: data.firstName,
|
||||
lastName: data.lastName,
|
||||
passwordHash: data.password
|
||||
});
|
||||
|
||||
await emailCheck(socket, user, null);
|
||||
} catch (Exception) {
|
||||
socket.emit("register", {error: {message: "invalid_email"}})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
Reference in a new issue