fix disable auth

pull/161/head
LouisLam 3 years ago
parent e34a8e2e4a
commit d707eba046

@ -114,11 +114,6 @@ let indexHTML = fs.readFileSync("./dist/index.html").toString();
socket.emit("setup") socket.emit("setup")
} }
if (await setting("disableAuth")) {
console.log("Disabled Auth: auto login to admin")
await afterLogin(socket, await R.findOne("user", " username = 'admin' "))
}
socket.on("disconnect", () => { socket.on("disconnect", () => {
totalClient--; totalClient--;
}); });
@ -139,8 +134,12 @@ let indexHTML = fs.readFileSync("./dist/index.html").toString();
]) ])
if (user) { if (user) {
debug("afterLogin")
await afterLogin(socket, user) await afterLogin(socket, user)
debug("afterLogin ok")
callback({ callback({
ok: true, ok: true,
}) })
@ -536,6 +535,18 @@ let indexHTML = fs.readFileSync("./dist/index.html").toString();
callback(false); callback(false);
} }
}); });
debug("added all socket handlers")
debug("check auto login")
if (await setting("disableAuth")) {
console.log("Disabled Auth: auto login to admin")
await afterLogin(socket, await R.findOne("user"))
socket.emit("autoLogin")
} else {
debug("need auth")
}
}); });
console.log("Init") console.log("Init")
@ -605,8 +616,6 @@ async function afterLogin(socket, user) {
} }
sendNotificationList(socket) sendNotificationList(socket)
socket.emit("autoLogin")
} }
async function getMonitorJSONList(userID) { async function getMonitorJSONList(userID) {

Loading…
Cancel
Save