Secure sockets listener for login or not login user
This commit is contained in:
parent
6477d8e074
commit
c4314c2678
1 changed files with 9 additions and 6 deletions
|
@ -1,10 +1,13 @@
|
||||||
module.exports = socket => {
|
module.exports = socket => {
|
||||||
console.log("New connection !");
|
console.log("New connection !");
|
||||||
|
if (!socket.request.session.user) {
|
||||||
socket.on("login", require("./login")(socket));
|
socket.on("login", require("./login")(socket));
|
||||||
socket.on("register", require("./register")(socket));
|
socket.on("register", require("./register")(socket));
|
||||||
socket.on("checkResend", require("./email/checkResend")(socket));
|
socket.on("checkResend", require("./email/checkResend")(socket));
|
||||||
socket.on("forgotPassword", require("./email/forgotPassword")(socket));
|
socket.on("forgotPassword", require("./email/forgotPassword")(socket));
|
||||||
socket.on("setPassword", require("./email/setPassword")(socket));
|
socket.on("setPassword", require("./email/setPassword")(socket));
|
||||||
|
} else {
|
||||||
socket.on("profileEdit", require("./profile/edit")(socket));
|
socket.on("profileEdit", require("./profile/edit")(socket));
|
||||||
|
}
|
||||||
socket.emit("connected");
|
socket.emit("connected");
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue