fix: 版本号 commit 哈希截断为 8 位;登录页校验会话有效性,修复登录与项目页互跳循环
build-and-deploy / build-and-deploy (push) Successful in 24s
build-and-deploy / build-and-deploy (push) Successful in 24s
This commit is contained in:
+13
-5
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user