2358
This commit is contained in:
1 parent
424355da7c
commit
7b3173e89d
5 files changed
+86
-6
No files matched your search
@@ -95,10 +95,20 @@ document.getElementById('form').addEventListener('submit', async function(e) {
|
||||
}
|
||||
});
|
||||
|
||||
// 已登录则直接跳转
|
||||
if (localStorage.getItem('wauth')) {
|
||||
location.href = '/';
|
||||
}
|
||||
// 已登录则验证后跳转
|
||||
(function(){
|
||||
var tok = localStorage.getItem('wauth');
|
||||
if (!tok) return;
|
||||
fetch('/auth/check', { headers: { 'Authorization': 'Basic ' + tok } }).then(function(r) {
|
||||
if (r.ok) {
|
||||
location.href = '/';
|
||||
} else {
|
||||
localStorage.removeItem('wauth');
|
||||
}
|
||||
}).catch(function() {
|
||||
localStorage.removeItem('wauth');
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user