From 9da8a621b8f3a00f17d6816067c49ed41417e1d0 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 31 Mar 2026 23:43:57 +0800 Subject: [PATCH] fix(login): switch frontend account login to oidc flow --- src/api/auth.js | 13 +++--- src/pages/LoginPage.vue | 87 +++++++++++++++-------------------------- 2 files changed, 39 insertions(+), 61 deletions(-) diff --git a/src/api/auth.js b/src/api/auth.js index e48d143..d0f7344 100644 --- a/src/api/auth.js +++ b/src/api/auth.js @@ -1,10 +1,13 @@ import { userHttp } from './http' -export const loginWithPassword = (username, password) => - userHttp.post('/auth/login', { username, password }) - -export const getOidcAuthorizeUrl = (redirectUri) => - userHttp.get('/auth/oidc/url', { params: { redirect_uri: redirectUri } }) +export const getOidcAuthorizeUrl = (redirectUri, options = {}) => + userHttp.get('/auth/oidc/url', { + params: { + redirect_uri: redirectUri, + login_hint: options.loginHint || undefined, + prompt: options.prompt || undefined + } + }) export const exchangeOidcCode = (code, redirectUri) => userHttp.post('/auth/oidc/exchange', { code, redirect_uri: redirectUri }) diff --git a/src/pages/LoginPage.vue b/src/pages/LoginPage.vue index 847997e..6fe9630 100644 --- a/src/pages/LoginPage.vue +++ b/src/pages/LoginPage.vue @@ -4,7 +4,7 @@ @@ -26,23 +26,13 @@ @keyup.enter="handlePasswordLogin" /> - - - - 帳號密碼登入 + 使用帳號登入 @@ -58,7 +48,7 @@
-

Google SSO 會跳轉到 Authentik,完成驗證後自動返回。

+

登入會跳轉到 Authentik 驗證,完成後自動返回。

登入成功後 access token 會存於本機 localStorage。

@@ -67,20 +57,16 @@