fixes
This commit is contained in:
@ -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 })
|
||||
|
Reference in New Issue
Block a user