From 9c00dda33ad7bd594dd8f331fa1bf0acefc2ca54 Mon Sep 17 00:00:00 2001 From: Anbraten <6918444+anbraten@users.noreply.github.com> Date: Fri, 5 Jul 2024 19:10:09 +0200 Subject: [PATCH] Refactor login page (#31530) As requested in https://github.com/go-gitea/gitea/pull/31504#issuecomment-2196196646. This PR refactor the login page: ![Screenshot from 2024-07-04 19-23-10](https://github.com/go-gitea/gitea/assets/6918444/c45700f4-6747-473c-bdee-2156718a7953) ![Screenshot from 2024-07-04 19-23-21](https://github.com/go-gitea/gitea/assets/6918444/b1bf71cf-85f9-4517-a409-cc6d72e6af8f) ![Screenshot from 2024-06-30 09-35-20](https://github.com/go-gitea/gitea/assets/6918444/728cc37e-0cca-4883-afec-a43663d2c666) # Changes - [x] use separate box for passkey login and go to registration - [x] move forgot passoword next to password label - [x] fix password required label `*` and padding - [x] remove tabs from login page --------- Co-authored-by: silverwind --- options/locale/locale_en-US.ini | 8 +- templates/user/auth/captcha.tmpl | 9 +- templates/user/auth/oauth_container.tmpl | 29 ++++++ templates/user/auth/signin.tmpl | 3 +- templates/user/auth/signin_inner.tmpl | 125 +++++++++++------------ templates/user/auth/signin_navbar.tmpl | 24 ----- templates/user/auth/signin_openid.tmpl | 69 ++++++++----- templates/user/auth/signup.tmpl | 5 +- templates/user/auth/signup_inner.tmpl | 41 +++----- web_src/css/form.css | 14 +++ 10 files changed, 170 insertions(+), 157 deletions(-) create mode 100644 templates/user/auth/oauth_container.tmpl delete mode 100644 templates/user/auth/signin_navbar.tmpl diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index d10f61f2ff..65ce6c6bc2 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -387,8 +387,8 @@ relevant_repositories = Only relevant repositories are being shown, %s. Please check your inbox within the next %s to complete the registration process. If your registration email address is incorrect, you can sign in again and change it. must_change_password = Update your password @@ -459,6 +460,7 @@ password_pwned = The password you chose is on a +
{{.Captcha.CreateHTML}}
@@ -7,18 +7,17 @@
{{else if eq .CaptchaType "recaptcha"}} -
+
{{else if eq .CaptchaType "hcaptcha"}} -
+
{{else if eq .CaptchaType "mcaptcha"}} -
- +
diff --git a/templates/user/auth/oauth_container.tmpl b/templates/user/auth/oauth_container.tmpl new file mode 100644 index 0000000000..7599b49fbb --- /dev/null +++ b/templates/user/auth/oauth_container.tmpl @@ -0,0 +1,29 @@ +{{if or .OAuth2Providers .EnableOpenIDSignIn}} +
+ {{ctx.Locale.Tr "sign_in_or"}} +
+
+{{end}} diff --git a/templates/user/auth/signin.tmpl b/templates/user/auth/signin.tmpl index b0e9ce8c74..54cc82d49d 100644 --- a/templates/user/auth/signin.tmpl +++ b/templates/user/auth/signin.tmpl @@ -1,8 +1,7 @@ {{template "base/head" .}}
- {{template "user/auth/signin_navbar" .}}
-
+
{{template "user/auth/signin_inner" .}}
diff --git a/templates/user/auth/signin_inner.tmpl b/templates/user/auth/signin_inner.tmpl index 51e0e3b982..b0a52d2c64 100644 --- a/templates/user/auth/signin_inner.tmpl +++ b/templates/user/auth/signin_inner.tmpl @@ -1,76 +1,65 @@ -{{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn)}} -{{template "base/alert" .}} -{{end}} -

- {{if .LinkAccountMode}} - {{ctx.Locale.Tr "auth.oauth_signin_title"}} - {{else}} - {{ctx.Locale.Tr "auth.login_userpass"}} +
+ {{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn)}} + {{template "base/alert" .}} {{end}} -

-
+

+ {{if .LinkAccountMode}} + {{ctx.Locale.Tr "auth.oauth_signin_title"}} + {{else}} + {{ctx.Locale.Tr "auth.login_userpass"}} + {{end}} +

+
+
+ {{.CsrfTokenHtml}} +
+ + +
+ {{if or (not .DisablePassword) .LinkAccountMode}} +
+ + {{ctx.Locale.Tr "auth.forgot_password"}} + +
+ {{end}} + {{if not .LinkAccountMode}} +
+
+ + +
+
+ {{end}} + + {{template "user/auth/captcha" .}} + +
+ +
+
+ + {{template "user/auth/oauth_container" .}} +
+
+ +
{{template "user/auth/webauthn_error" .}} -
- {{.CsrfTokenHtml}} -
- - -
- {{if or (not .DisablePassword) .LinkAccountMode}} -
- - -
- {{end}} - {{if not .LinkAccountMode}} -
-
- - -
-
- {{end}} - - {{template "user/auth/captcha" .}} - -
- - {{ctx.Locale.Tr "auth.forgot_password"}} -
- - {{if .ShowRegistrationButton}} - - {{end}} - -
+ - {{if .OAuth2Providers}} -
- {{ctx.Locale.Tr "sign_in_or"}} -
-
-
-
- {{range $provider := .OAuth2Providers}} - - {{end}} + {{if .ShowRegistrationButton}} +
+ {{ctx.Locale.Tr "auth.need_account"}} + {{ctx.Locale.Tr "auth.sign_up_now"}}
-
+ {{end}}
- {{end}} -
diff --git a/templates/user/auth/signin_navbar.tmpl b/templates/user/auth/signin_navbar.tmpl deleted file mode 100644 index 7f52185a7d..0000000000 --- a/templates/user/auth/signin_navbar.tmpl +++ /dev/null @@ -1,24 +0,0 @@ -{{if or .EnableOpenIDSignIn .EnableSSPI}} - - - -{{end}} diff --git a/templates/user/auth/signin_openid.tmpl b/templates/user/auth/signin_openid.tmpl index c1f392dc13..20c7bdc924 100644 --- a/templates/user/auth/signin_openid.tmpl +++ b/templates/user/auth/signin_openid.tmpl @@ -1,35 +1,50 @@ {{template "base/head" .}}