feat: 6-digit email verification code, fix missing script+route includes

This commit is contained in:
2026-07-17 00:34:47 +08:00
parent bfc63a8194
commit ead50beccd
4 changed files with 44 additions and 20 deletions

View File

@@ -62,17 +62,13 @@ const App = {
const param = parts.slice(1).join('/');
if (page === 'verify') {
const params = new URLSearchParams((location.hash.split('?')[1] || ''));
const token = params.get('token');
if (token) {
API.get(`/auth/verify-email?token=${token}`).then(r => { alert(r.message || '验证成功'); location.hash = '#/login'; }).catch(e => { alert(e.message); location.hash = '#/home'; });
}
this.showPublic('verify');
return;
}
if (page === 'install') { this.showPublic('install'); return; }
if (page === 'home') { this.showPublic('home', param); return; }
if (page === 'login' || page === 'register') { this.showPublic(page); return; }
if (page === 'login' || page === 'register' || page === 'forgot' || page === 'reset') { this.showPublic(page); return; }
if (!Auth.logged()) { location.hash = '#/login'; return; }
this.showLayout();
@@ -184,6 +180,9 @@ window.LoginPage = LoginPage;
window.RegisterPage = RegisterPage;
window.HomePage = HomePage;
window.InstallPage = InstallPage;
window.ForgotPage = ForgotPage;
window.ResetPage = ResetPage;
window.VerifyPage = VerifyPage;
window.U = U;
window.Auth = Auth;
window.API = API;