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 @@

<%= t("login.heading") %>

-
-
- -
- -
-
- <% if( totpEnabled ) { %> + <% if (ssoEnabled) { %> + + Google logo + <%= t("login.sign_in_with_google") %> + + <% } else { %> +
- +
- +
- <% } %> - - <% if ( wrongPassword ) { %> -
- <%= t("login.incorrect-password") %> -
- <% } %> - <% if ( totpEnabled ) { %> - <% if( wrongTotp ) { %> -
- <%= t("login.incorrect-totp") %> + <% if( totpEnabled ) { %> +
+ +
+ +
<% } %> - <% } %> - -
-
- + <% if ( wrongPassword ) { %> +
+ <%= t("login.incorrect-password") %> +
+ <% } %> + <% if ( totpEnabled ) { %> + <% if( wrongTotp ) { %> +
+ <%= t("login.incorrect-totp") %> +
+ <% } %> + <% } %> + + +
+
+ +
-
-
- -
- +
+ +
+ + <% } %>
diff --git a/translations/en/server.json b/translations/en/server.json index 3ad4b5d84..8e5633cd0 100644 --- a/translations/en/server.json +++ b/translations/en/server.json @@ -102,7 +102,8 @@ "incorrect-password": "Password is incorrect. Please try again.", "password": "Password", "remember-me": "Remember me", - "button": "Login" + "button": "Login", + "sign_in_with_google": "Sign in with Google" }, "set_password": { "title": "Set Password",