mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Removing userpass if userpass isnt needed on login on channel
This commit is contained in:
@@ -35,13 +35,11 @@ function list(msg, guid, coll, offline, socket) {
|
|||||||
if(typeof(msg) === 'object' && msg !== undefined && msg !== null)
|
if(typeof(msg) === 'object' && msg !== undefined && msg !== null)
|
||||||
{
|
{
|
||||||
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass, adminpass, gotten) {
|
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass, adminpass, gotten) {
|
||||||
console.log(gotten, userpass, msg.hasOwnProperty("pass"));
|
|
||||||
if(gotten && userpass != "" && !msg.hasOwnProperty("pass")) {
|
if(gotten && userpass != "" && !msg.hasOwnProperty("pass")) {
|
||||||
msg.pass = userpass;
|
msg.pass = userpass;
|
||||||
} else {
|
} else {
|
||||||
msg.pass = crypto.createHash('sha256').update(Functions.decrypt_string(msg.pass)).digest("base64");
|
msg.pass = crypto.createHash('sha256').update(Functions.decrypt_string(msg.pass)).digest("base64");
|
||||||
}
|
}
|
||||||
console.log(msg.pass);
|
|
||||||
adminpass = Functions.hash_pass(adminpass);
|
adminpass = Functions.hash_pass(adminpass);
|
||||||
if(!msg.hasOwnProperty('version') || !msg.hasOwnProperty("channel") ||
|
if(!msg.hasOwnProperty('version') || !msg.hasOwnProperty("channel") ||
|
||||||
msg.version != VERSION || msg.version == undefined ||
|
msg.version != VERSION || msg.version == undefined ||
|
||||||
@@ -75,6 +73,9 @@ function list(msg, guid, coll, offline, socket) {
|
|||||||
Functions.setSessionUserPass(Functions.getSession(socket), msg.pass, coll, function(){})
|
Functions.setSessionUserPass(Functions.getSession(socket), msg.pass, coll, function(){})
|
||||||
socket.emit("auth_accepted", {value: true});
|
socket.emit("auth_accepted", {value: true});
|
||||||
}
|
}
|
||||||
|
if(docs.length > 0 && docs[0].userpass != pass) {
|
||||||
|
Functions.setSessionUserPass(Functions.getSession(socket), "", coll, function(){})
|
||||||
|
}
|
||||||
if(docs.length > 0 && docs[0].hasOwnProperty("adminpass") && docs[0].adminpass != "" && docs[0].adminpass == adminpass) {
|
if(docs.length > 0 && docs[0].hasOwnProperty("adminpass") && docs[0].adminpass != "" && docs[0].adminpass == adminpass) {
|
||||||
socket.emit("pw", true);
|
socket.emit("pw", true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user