1
0
Fork 0

Merge branch 'back' into 'master'

Fix register socket

See merge request LETU/LETU!24
This commit is contained in:
Ethanell 2020-12-15 13:26:11 +01:00
commit 7a3be9242c

View file

@ -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 {
let user = await models.User.create({
email: data.email,
firstName: data.firstName,
lastName: data.lastName,
passwordHash: data.password
});
await emailCheck(socket, user, null);
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"}})
}
}
}
};
};