From 11ffd428990e9f29e41a584934417625547271b0 Mon Sep 17 00:00:00 2001 From: uncle6me-web Date: Sat, 25 Jul 2026 21:12:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(portal/t49):=20=E9=A6=96=E7=99=BB=E9=A0=81?= =?UTF-8?q?=E8=A3=9C=E9=80=83=E7=94=9F=E5=8F=A3=E2=80=94=E2=80=94=E3=80=8E?= =?UTF-8?q?=E5=B7=B2=E7=B6=93=E6=9C=89=E5=B8=B3=E8=99=9F=EF=BC=9F=E6=94=B9?= =?UTF-8?q?=E7=94=A8=E7=99=BB=E5=85=A5=E3=80=8F=EF=BC=8Bsetup=20409=20?= =?UTF-8?q?=E8=87=AA=E5=8B=95=E5=88=87=E7=99=BB=E5=85=A5=E5=B8=B6=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=EF=BC=88leo=20=E5=AF=A6=E6=92=9E=E6=AD=BB=E8=B7=AF?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- console-ui/public/portal/index.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/console-ui/public/portal/index.html b/console-ui/public/portal/index.html index 2e7f114..febd877 100644 --- a/console-ui/public/portal/index.html +++ b/console-ui/public/portal/index.html @@ -200,6 +200,8 @@
+ +
這組帳密就是之後登入知識庫用的,只需要設定這一次。
@@ -680,6 +682,10 @@ function taipeiMonthDay(ms) { var d = new Date(ms + TAIPEI_OFFSET_MS); return { // 四發全是既有端點,一顆按鈕做完;用戶感受=「建一組帳密就進來了」。 $('fs-submit').addEventListener('click', doFirstSetup); $('fs-password2').addEventListener('keydown', function (ev) { if (ev.key === 'Enter') doFirstSetup(); }); + $('fs-tologin').addEventListener('click', function () { + $('v-firstsetup').classList.remove('on'); + $('v-login').classList.add('on'); + }); function doFirstSetup() { var email = $('fs-email').value.trim(); var pw = $('fs-password').value; @@ -696,6 +702,15 @@ function taipeiMonthDay(ms) { var d = new Date(ms + TAIPEI_OFFSET_MS); return { }; post('/console/setup', { email: email, password: pw }) .then(function (x) { + // 已設定過(409)=這實例其實有人建過了——自動帶去登入,別把用戶困在死路(leo 實撞) + if (x.status === 409) { + $('fs-submit').disabled = false; + $('v-firstsetup').classList.remove('on'); + $('v-login').classList.add('on'); + $('login-email').value = email; + $('login-status').textContent = '這個知識庫已經設定過帳號了,直接登入即可。'; + throw { handled: true }; + } if (!x.ok || !x.d.session_token) throw new Error(x.d.error || '設定沒有成功,請再試一次'); var ownerTok = x.d.session_token; return post('/portal/admin/bootstrap', { email: email, password: pw, display_name: email.split('@')[0] }, { Authorization: 'Bearer ' + ownerTok }) @@ -724,6 +739,7 @@ function taipeiMonthDay(ms) { var d = new Date(ms + TAIPEI_OFFSET_MS); return { boot(); }) .catch(function (e) { + if (e && e.handled) return; // 409 已自動切登入,不再顯示錯誤 $('fs-submit').disabled = false; st.textContent = (e && e.message) || friendlyErr(e); });