move sign in labels to be above inputs (#28753)

There are a few inconsistencies within Gitea and this PR addresses one of them.
This PR updates the sign-in page layout, including the register and openID tabs,
to match the layout of the settings pages (`/user/settings`) for more consistency.

**Before**
<img width="968" alt="Screenshot 2024-02-05 at 8 27 24 AM"
src="https://github.com/go-gitea/gitea/assets/6152817/fb0cb517-57c0-4eed-be1d-56f36bd1960d">

**After**
<img width="968" alt="Screenshot 2024-02-05 at 8 26 39 AM"
src="https://github.com/go-gitea/gitea/assets/6152817/428d691d-0a42-4a67-a646-05527f2a7b41">

---------

Co-authored-by: rafh <rafaelheard@gmail.com>
(cherry picked from commit 1c14cd0c43d670fef984068e2666641ea5a062db)
This commit is contained in:
Rafael Heard 2024-02-15 03:47:49 -05:00 committed by Earl Warren
parent 65248945c9
commit 4af0944b26
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
5 changed files with 13 additions and 21 deletions

View file

@ -9,21 +9,20 @@
{{end}} {{end}}
</h4> </h4>
<div class="ui attached segment"> <div class="ui attached segment">
<form class="ui form" action="{{.SignInLink}}" method="post"> <form class="ui form gt-max-width-36rem gt-m-auto" action="{{.SignInLink}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="required inline field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}"> <div class="required inline field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}">
<label for="user_name">{{ctx.Locale.Tr "home.uname_holder"}}</label> <label for="user_name">{{ctx.Locale.Tr "home.uname_holder"}}</label>
<input id="user_name" type="text" name="user_name" value="{{.user_name}}" autofocus required> <input id="user_name" class="gt-w-full" type="text" name="user_name" value="{{.user_name}}" autofocus required>
</div> </div>
{{if or (not .DisablePassword) .LinkAccountMode}} {{if or (not .DisablePassword) .LinkAccountMode}}
<div class="required inline field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}"> <div class="required inline field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}">
<label for="password">{{ctx.Locale.Tr "password"}}</label> <label for="password">{{ctx.Locale.Tr "password"}}</label>
<input id="password" name="password" type="password" value="{{.password}}" autocomplete="current-password" required> <input id="password" class="gt-w-full" name="password" type="password" value="{{.password}}" autocomplete="current-password" required>
</div> </div>
{{end}} {{end}}
{{if not .LinkAccountMode}} {{if not .LinkAccountMode}}
<div class="inline field"> <div class="inline field">
<label></label>
<div class="ui checkbox"> <div class="ui checkbox">
<label>{{ctx.Locale.Tr "auth.remember_me"}}</label> <label>{{ctx.Locale.Tr "auth.remember_me"}}</label>
<input name="remember" type="checkbox"> <input name="remember" type="checkbox">
@ -34,7 +33,6 @@
{{template "user/auth/captcha" .}} {{template "user/auth/captcha" .}}
<div class="inline field"> <div class="inline field">
<label></label>
<button class="ui primary button"> <button class="ui primary button">
{{if .LinkAccountMode}} {{if .LinkAccountMode}}
{{ctx.Locale.Tr "auth.oauth_signin_submit"}} {{ctx.Locale.Tr "auth.oauth_signin_submit"}}
@ -47,7 +45,6 @@
{{if .ShowRegistrationButton}} {{if .ShowRegistrationButton}}
<div class="inline field"> <div class="inline field">
<label></label>
<a href="{{AppSubUrl}}/user/sign_up">{{ctx.Locale.Tr "auth.sign_up_now" | Str2html}}</a> <a href="{{AppSubUrl}}/user/sign_up">{{ctx.Locale.Tr "auth.sign_up_now" | Str2html}}</a>
</div> </div>
{{end}} {{end}}
@ -60,7 +57,7 @@
<div class="gt-df gt-fc gt-jc"> <div class="gt-df gt-fc gt-jc">
<div id="oauth2-login-navigator-inner" class="gt-df gt-fc gt-fw gt-ac gt-gap-3"> <div id="oauth2-login-navigator-inner" class="gt-df gt-fc gt-fw gt-ac gt-gap-3">
{{range $provider := .OAuth2Providers}} {{range $provider := .OAuth2Providers}}
<a class="{{$provider.Name}} ui button gt-df gt-ac gt-jc gt-py-3 oauth-login-link" href="{{AppSubUrl}}/user/oauth2/{{$provider.DisplayName}}"> <a class="{{$provider.Name}} ui button gt-df gt-ac gt-jc gt-py-3 gt-w-full oauth-login-link" href="{{AppSubUrl}}/user/oauth2/{{$provider.DisplayName}}">
{{$provider.IconHTML 28}} {{$provider.IconHTML 28}}
{{ctx.Locale.Tr "sign_in_with_provider" $provider.DisplayName}} {{ctx.Locale.Tr "sign_in_with_provider" $provider.DisplayName}}
</a> </a>

View file

@ -8,7 +8,7 @@
OpenID OpenID
</h4> </h4>
<div class="ui attached segment"> <div class="ui attached segment">
<form class="ui form" action="{{.Link}}" method="post"> <form class="ui form gt-m-auto" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<div class="inline field"> <div class="inline field">
{{ctx.Locale.Tr "auth.openid_signin_desc"}} {{ctx.Locale.Tr "auth.openid_signin_desc"}}
@ -18,17 +18,15 @@
{{svg "fontawesome-openid"}} {{svg "fontawesome-openid"}}
OpenID URI OpenID URI
</label> </label>
<input id="openid" name="openid" value="{{.openid}}" autofocus required> <input id="openid" class="gt-w-full" name="openid" value="{{.openid}}" autofocus required>
</div> </div>
<div class="inline field"> <div class="inline field">
<label></label>
<div class="ui checkbox"> <div class="ui checkbox">
<label>{{ctx.Locale.Tr "auth.remember_me"}}</label> <label>{{ctx.Locale.Tr "auth.remember_me"}}</label>
<input name="remember" type="checkbox"> <input name="remember" type="checkbox">
</div> </div>
</div> </div>
<div class="inline field"> <div class="inline field">
<label></label>
<button class="ui primary button">{{ctx.Locale.Tr "sign_in"}}</button> <button class="ui primary button">{{ctx.Locale.Tr "sign_in"}}</button>
</div> </div>
</form> </form>

View file

@ -7,7 +7,7 @@
{{end}} {{end}}
</h4> </h4>
<div class="ui attached segment"> <div class="ui attached segment">
<form class="ui form" action="{{.SignUpLink}}" method="post"> <form class="ui form gt-max-width-36rem gt-m-auto" action="{{.SignUpLink}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
{{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister)}} {{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister)}}
{{template "base/alert" .}} {{template "base/alert" .}}
@ -17,28 +17,27 @@
{{else}} {{else}}
<div class="required inline field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}"> <div class="required inline field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
<label for="user_name">{{ctx.Locale.Tr "username"}}</label> <label for="user_name">{{ctx.Locale.Tr "username"}}</label>
<input id="user_name" type="text" name="user_name" value="{{.user_name}}" autofocus required> <input id="user_name" class="gt-w-full" type="text" name="user_name" value="{{.user_name}}" autofocus required>
</div> </div>
<div class="required inline field {{if .Err_Email}}error{{end}}"> <div class="required inline field {{if .Err_Email}}error{{end}}">
<label for="email">{{ctx.Locale.Tr "email"}}</label> <label for="email">{{ctx.Locale.Tr "email"}}</label>
<input id="email" name="email" type="email" value="{{.email}}" required> <input id="email" class="gt-w-full" name="email" type="email" value="{{.email}}" required>
</div> </div>
{{if not .DisablePassword}} {{if not .DisablePassword}}
<div class="required inline field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}"> <div class="required inline field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
<label for="password">{{ctx.Locale.Tr "password"}}</label> <label for="password">{{ctx.Locale.Tr "password"}}</label>
<input id="password" name="password" type="password" value="{{.password}}" autocomplete="new-password" required> <input id="password" class="gt-w-full" name="password" type="password" value="{{.password}}" autocomplete="new-password" required>
</div> </div>
<div class="required inline field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}"> <div class="required inline field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
<label for="retype">{{ctx.Locale.Tr "re_type"}}</label> <label for="retype">{{ctx.Locale.Tr "re_type"}}</label>
<input id="retype" name="retype" type="password" value="{{.retype}}" autocomplete="new-password" required> <input id="retype" class="gt-w-full" name="retype" type="password" value="{{.retype}}" autocomplete="new-password" required>
</div> </div>
{{end}} {{end}}
{{template "user/auth/captcha" .}} {{template "user/auth/captcha" .}}
<div class="inline field"> <div class="inline field">
<label></label>
<button class="ui primary button"> <button class="ui primary button">
{{if .LinkAccountMode}} {{if .LinkAccountMode}}
{{ctx.Locale.Tr "auth.oauth_signup_submit"}} {{ctx.Locale.Tr "auth.oauth_signup_submit"}}
@ -50,7 +49,6 @@
{{if not .LinkAccountMode}} {{if not .LinkAccountMode}}
<div class="inline field"> <div class="inline field">
<label></label>
<a href="{{AppSubUrl}}/user/login">{{ctx.Locale.Tr "auth.register_helper_msg"}}</a> <a href="{{AppSubUrl}}/user/login">{{ctx.Locale.Tr "auth.register_helper_msg"}}</a>
</div> </div>
{{end}} {{end}}
@ -64,7 +62,7 @@
<div class="gt-df gt-fc gt-jc"> <div class="gt-df gt-fc gt-jc">
<div id="oauth2-login-navigator-inner" class="gt-df gt-fc gt-fw gt-ac gt-gap-3"> <div id="oauth2-login-navigator-inner" class="gt-df gt-fc gt-fw gt-ac gt-gap-3">
{{range $provider := .OAuth2Providers}} {{range $provider := .OAuth2Providers}}
<a class="{{$provider.Name}} ui button gt-df gt-ac gt-jc gt-py-3 oauth-login-link" href="{{AppSubUrl}}/user/oauth2/{{$provider.DisplayName}}"> <a class="{{$provider.Name}} ui button gt-df gt-ac gt-jc gt-py-3 gt-w-full oauth-login-link" href="{{AppSubUrl}}/user/oauth2/{{$provider.DisplayName}}">
{{$provider.IconHTML 28}} {{$provider.IconHTML 28}}
{{ctx.Locale.Tr "sign_in_with_provider" $provider.DisplayName}} {{ctx.Locale.Tr "sign_in_with_provider" $provider.DisplayName}}
</a> </a>

View file

@ -243,7 +243,6 @@ textarea:focus,
.user.forgot.password form, .user.forgot.password form,
.user.reset.password form, .user.reset.password form,
.user.link-account form, .user.link-account form,
.user.signin form,
.user.signup form { .user.signup form {
margin: auto; margin: auto;
width: 700px !important; width: 700px !important;
@ -279,7 +278,6 @@ textarea:focus,
.user.forgot.password form .inline.field > label, .user.forgot.password form .inline.field > label,
.user.reset.password form .inline.field > label, .user.reset.password form .inline.field > label,
.user.link-account form .inline.field > label, .user.link-account form .inline.field > label,
.user.signin form .inline.field > label,
.user.signup form .inline.field > label { .user.signup form .inline.field > label {
text-align: right; text-align: right;
width: 250px !important; width: 250px !important;

View file

@ -48,6 +48,7 @@ Gitea's private styles use `g-` prefix.
.gt-max-width-12rem { max-width: 12rem !important; } .gt-max-width-12rem { max-width: 12rem !important; }
.gt-max-width-24rem { max-width: 24rem !important; } .gt-max-width-24rem { max-width: 24rem !important; }
.gt-max-width-36rem { max-width: 36rem !important; }
/* below class names match Tailwind CSS */ /* below class names match Tailwind CSS */
.gt-break-all { word-break: break-all !important; } .gt-break-all { word-break: break-all !important; }