fix: 版本号 commit 哈希截断为 8 位;登录页校验会话有效性,修复登录与项目页互跳循环
build-and-deploy / build-and-deploy (push) Successful in 24s

This commit is contained in:
jif2.zhang
2026-09-14 09:55:25 +08:00
parent 37c781e6b9
commit 2ba09fa7a1
2 changed files with 19 additions and 7 deletions
+13 -5
View File
@@ -65,11 +65,6 @@
.catch(function () {});
</script>
<script>
// 已登录则直接跳转
if (localStorage.getItem("registry_token")) {
window.location.href = "/projects.html";
}
document.getElementById("login-form").addEventListener("submit", async function (e) {
e.preventDefault();
var error = document.getElementById("login-error");
@@ -102,5 +97,18 @@
});
</script>
<script src="/js/api.js"></script>
<script>
// 已登录则校验会话有效性后跳转;token 失效则清理并留在登录页(避免与内页互相跳转)
if (localStorage.getItem("registry_token")) {
API.getMe()
.then(function () {
window.location.href = "/projects.html";
})
.catch(function () {
localStorage.removeItem("registry_token");
localStorage.removeItem("registry_user");
});
}
</script>
</body>
</html>