diff --git a/homepage/index.html b/homepage/index.html
index f005ccd..4005dcc 100644
--- a/homepage/index.html
+++ b/homepage/index.html
@@ -908,6 +908,13 @@ async function handleLogin() {
showLoggedIn(d.username);
if (d.is_admin) document.getElementById('gen-code-btn').style.display = '';
document.getElementById('login-pass').value = '';
+ // 登录成功即创建所有模块通行证
+ fetch('/api/auth/quick-login?username=' + encodeURIComponent(d.username))
+ .then(function(r) { return r.json(); })
+ .then(function(d2) {
+ if (d2.token) localStorage.setItem('corpus_token', d2.token);
+ })
+ .catch(function() {});
} else {
showLoginErr(d.error || '登录失败');
}
@@ -944,8 +951,10 @@ function logout() {
}
function goToRepo() {
+ // 首页登录不传Forgejo会话,跳转到Forgejo登录(带仓库重定向)
const u = localStorage.getItem('current_user');
- if (u) window.location.href = '/code/' + u;
+ if (u) window.location.href = "/code/user/login?redirect_to=/code/" + encodeURIComponent(u) + "/guanghulab";
+ else window.location.href = '/code/user/login';
}
function toggleLogin() {
@@ -1057,4 +1066,4 @@ async function sendMessage() {