This commit is contained in:
2023-06-27 14:58:28 +05:00
parent 8e05bba5d4
commit 681c1455f6
6 changed files with 191 additions and 163 deletions

View File

@ -39,7 +39,8 @@ function log_by_sid() {
// const sid = $.cookie("sid");
console.log("log");
if($.cookie('sid') == null){
get_sid(location.hostname);
// get_sid(location.hostname);
clear_ck(false);
}else{
$.post( "/sid_log")
.done(function( res ) {
@ -53,19 +54,19 @@ function log_by_sid() {
})}
}
function clear_ck(){
function clear_ck(redirect = true){
$.cookie("uuid",null);
$.cookie("sid",null);
goto("login");
get_sid(location.hostname);
if (redirect) goto("login");
}
function check_sid(){
console.log("checking sid");
if($.cookie('sid') == null){
if($.cookie('sid') == null || $.cookie('uuid') == null){
clear_ck();
}
else{
console.log("ping");
$.post( "/sid_log")
.done(function( res ) {
if(res["out"] == "bad"){
@ -75,6 +76,13 @@ function check_sid(){
}
}
function logout() {
let dialog = confirm("logout?");
if(dialog){
clear_ck();
}
}
function get_sid(hostname){
$.post( "/get_sid", { name:hostname })