Browse Source

feat(auth): add forced logout prompt function

add logoutSystemQ method to show logout confirmation and handle logout process
lsc 2 days ago
parent
commit
c02de9805b
1 changed files with 17 additions and 0 deletions
  1. 17 0
      uform.js

+ 17 - 0
uform.js

@@ -12305,6 +12305,23 @@ U.MD.U.LO.logoutSystem = function(callback) {
     }
 }
 
+/**
+* 强制退出登录提示
+*
+* @param callback {function} 登出回调函数
+*/
+U.MD.U.LO.logoutSystemQ = function (callback) {
+    //如果用户登录的情况
+    if (US.userInfo.userid) {
+        //弹出退出登录的提示
+        U.A.Request(US.Config.server + "logout", [], function (res) {
+                U.alert("logout success!")
+                window.onbeforeunload = null
+                window.location.reload();
+        }, [], { "type": "POST", "withCredentials": true });
+    }
+}
+
 //确定注销
 //b为是否清除cookie的参数。如果传递false,则清除cookie。