From 886e63f12826034ec6535db64ca224a65b2a7f1b Mon Sep 17 00:00:00 2001 From: Jin <22962980+JYC333@users.noreply.github.com> Date: Wed, 26 Mar 2025 01:48:42 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20Add=20SSO=20login=20butt?= =?UTF-8?q?on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- images/google-logo.svg | 7 ++ src/public/stylesheets/theme-next/pages.css | 25 +++++++ src/routes/login.ts | 20 +++--- src/views/login.ejs | 75 +++++++++++---------- translations/en/server.json | 3 +- 5 files changed, 83 insertions(+), 47 deletions(-) create mode 100644 images/google-logo.svg diff --git a/images/google-logo.svg b/images/google-logo.svg new file mode 100644 index 000000000..c69cd1e7f --- /dev/null +++ b/images/google-logo.svg @@ -0,0 +1,7 @@ + + \ No newline at end of file diff --git a/src/public/stylesheets/theme-next/pages.css b/src/public/stylesheets/theme-next/pages.css index e5778d4ce..7cc1ee77b 100644 --- a/src/public/stylesheets/theme-next/pages.css +++ b/src/public/stylesheets/theme-next/pages.css @@ -32,6 +32,31 @@ color: var(--dropdown-item-icon-destructive-color) !important; } +.google-login-btn { + display: flex; + align-items: center; + justify-content: center; + background-color: #fff; + color: #757575; + border: 1px solid #ddd; + border-radius: 4px; + padding: 10px 20px; + font-size: 14px; + font-weight: 500; + cursor: pointer; + margin-bottom: 20px; + text-decoration: none; + transition: background-color 0.3s; +} +.google-login-btn:hover { + background-color: #f5f5f5; +} +.google-login-btn img { + margin-right: 10px; + width: 18px; + height: 18px; +} + /* * SEARCH PAGE */ diff --git a/src/routes/login.ts b/src/routes/login.ts index 311637e02..e0f297c0a 100644 --- a/src/routes/login.ts +++ b/src/routes/login.ts @@ -14,18 +14,14 @@ import totp from '../services/totp.js'; import open_id from '../services/open_id.js'; function loginPage(req: Request, res: Response) { - if (open_id.isOpenIDEnabled()) { - res.redirect('/authenticate'); - } else { - res.render('login', { - wrongPassword: false, - wrongTotp: false, - totpEnabled: totp.isTotpEnabled(), - ssoEnabled: open_id.isOpenIDEnabled(), - assetPath: assetPath, - appPath: appPath, - }); - } + res.render('login', { + wrongPassword: false, + wrongTotp: false, + totpEnabled: totp.isTotpEnabled(), + ssoEnabled: open_id.isOpenIDEnabled(), + assetPath: assetPath, + appPath: appPath, + }); } function setPasswordPage(req: Request, res: Response) { diff --git a/src/views/login.ejs b/src/views/login.ejs index f07b924d2..56c2bf762 100644 --- a/src/views/login.ejs +++ b/src/views/login.ejs @@ -24,48 +24,55 @@