This commit is contained in:
Vaica committed 2026-06-21 23:58:29 +08:00
1 parent 424355da7c
commit 7b3173e89d
5 files changed
+86 -6

No files matched your search

+14 -4
View File
@@ -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>