Skip to content

Commit c996e35

Browse files
rafhrafh
and
rafh
authored
Move all login and account creation page labels to be above inputs (#29432)
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. This PR updates the following routes: `/user/login` `/user/sign_up` `/user/login/openid` `/user/forgot_password` `/user/link_account` `/user/recover_account` **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"> This PR addresses a revert of the original PR due to this [comment](#28753 (comment)). --------- Co-authored-by: rafh <[email protected]>
1 parent 1d25489 commit c996e35

13 files changed

+34
-58
lines changed

templates/user/auth/activate.tmpl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@
22
<div role="main" aria-label="{{.Title}}" class="page-content user activate">
33
<div class="ui middle very relaxed page grid">
44
<div class="column">
5-
<form class="ui form ignore-dirty" action="{{AppSubUrl}}/user/activate" method="post">
5+
<form class="ui form ignore-dirty tw-max-w-2xl tw-m-auto" action="{{AppSubUrl}}/user/activate" method="post">
66
{{.CsrfTokenHtml}}
77
<h2 class="ui top attached header">
88
{{ctx.Locale.Tr "auth.active_your_account"}}
99
</h2>
1010
<div class="ui attached segment">
1111
{{template "base/alert" .}}
1212
{{if .NeedVerifyLocalPassword}}
13-
<div class="required inline field">
13+
<div class="required field">
1414
<label for="verify-password">{{ctx.Locale.Tr "password"}}</label>
1515
<input id="verify-password" name="password" type="password" autocomplete="off" required>
1616
</div>
1717
<div class="inline field">
18-
<label></label>
1918
<button class="ui primary button">{{ctx.Locale.Tr "install.confirm_password"}}</button>
2019
</div>
2120
<input name="code" type="hidden" value="{{.ActivationCode}}">
@@ -29,7 +28,7 @@
2928
</div>
3029
</details>
3130
<div class="divider"></div>
32-
<div class="text right">
31+
<div class="text">
3332
<button class="ui primary button">{{ctx.Locale.Tr "auth.resend_mail"}}</button>
3433
</div>
3534
{{end}}

templates/user/auth/captcha.tmpl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{{if .EnableCaptcha}}{{if eq .CaptchaType "image"}}
22
<div class="inline field">
3-
<label>{{/* This is CAPTCHA field */}}</label>
43
{{.Captcha.CreateHTML}}
54
</div>
6-
<div class="required inline field {{if .Err_Captcha}}error{{end}}">
5+
<div class="required field {{if .Err_Captcha}}error{{end}}">
76
<label for="captcha">{{ctx.Locale.Tr "captcha"}}</label>
87
<input id="captcha" name="captcha" value="{{.captcha}}" autocomplete="off">
98
</div>

templates/user/auth/change_passwd_inner.tmpl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@
55
{{ctx.Locale.Tr "settings.change_password"}}
66
</h4>
77
<div class="ui attached segment">
8-
<form class="ui form" action="{{.ChangePasscodeLink}}" method="post">
8+
<form class="ui form tw-max-w-2xl tw-m-auto" action="{{.ChangePasscodeLink}}" method="post">
99
{{.CsrfTokenHtml}}
10-
<div class="required inline field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}">
10+
<div class="required field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}">
1111
<label for="password">{{ctx.Locale.Tr "password"}}</label>
1212
<input id="password" name="password" type="password" value="{{.password}}" autocomplete="new-password" required>
1313
</div>
14-
<div class="required inline field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
14+
<div class="required field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
1515
<label for="retype">{{ctx.Locale.Tr "re_type"}}</label>
1616
<input id="retype" name="retype" type="password" autocomplete="new-password" required>
1717
</div>
1818
<div class="inline field">
19-
<label></label>
2019
<button class="ui primary button">{{ctx.Locale.Tr "settings.change_password"}}</button>
2120
</div>
2221
</form>

templates/user/auth/forgot_passwd.tmpl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@
1212
{{if .IsResetSent}}
1313
<p>{{ctx.Locale.Tr "auth.reset_password_mail_sent_prompt" .Email .ResetPwdCodeLives}}</p>
1414
{{else if .IsResetRequest}}
15-
<div class="required inline field {{if .Err_Email}}error{{end}}">
15+
<div class="required field {{if .Err_Email}}error{{end}}">
1616
<label for="email">{{ctx.Locale.Tr "email"}}</label>
1717
<input id="email" name="email" type="email" value="{{.Email}}" autofocus required>
1818
</div>
1919
<div class="divider"></div>
2020
<div class="inline field">
21-
<label></label>
2221
<button class="ui primary button">{{ctx.Locale.Tr "auth.send_reset_mail"}}</button>
2322
</div>
2423
{{else if .IsResetDisable}}

templates/user/auth/prohibit_login.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div role="main" aria-label="{{.Title}}" class="page-content user activate">
33
<div class="ui middle very relaxed page grid">
44
<div class="column">
5-
<form class="ui form">
5+
<form class="ui form tw-max-w-2xl tw-m-auto">
66
<h2 class="ui top attached header">
77
{{ctx.Locale.Tr "auth.prohibit_login"}}
88
</h2>

templates/user/auth/reset_passwd.tmpl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@
1717
</div>
1818
{{end}}
1919
{{if .IsResetForm}}
20-
<div class="required inline field {{if .Err_Password}}error{{end}}">
20+
<div class="required field {{if .Err_Password}}error{{end}}">
2121
<label for="password">{{ctx.Locale.Tr "settings.new_password"}}</label>
2222
<input id="password" name="password" type="password" value="{{.password}}" autocomplete="new-password" autofocus required>
2323
</div>
2424
{{if not .user_signed_in}}
2525
<div class="inline field">
26-
<label></label>
2726
<div class="ui checkbox">
2827
<label>{{ctx.Locale.Tr "auth.remember_me"}}</label>
2928
<input name="remember" type="checkbox">
@@ -42,15 +41,14 @@
4241
</div>
4342
<input type="hidden" name="scratch_code" value="true">
4443
{{else}}
45-
<div class="required inline field {{if .Err_Passcode}}error{{end}}">
44+
<div class="required field {{if .Err_Passcode}}error{{end}}">
4645
<label for="passcode">{{ctx.Locale.Tr "passcode"}}</label>
4746
<input id="passcode" name="passcode" type="number" autocomplete="off" autofocus required>
4847
</div>
4948
{{end}}
5049
{{end}}
5150
<div class="divider"></div>
5251
<div class="inline field">
53-
<label></label>
5452
<button class="ui primary button">{{ctx.Locale.Tr "auth.reset_password_helper"}}</button>
5553
{{if and .has_two_factor (not .scratch_code)}}
5654
<a href="{{.Link}}?code={{.Code}}&amp;scratch_code=true">{{ctx.Locale.Tr "auth.use_scratch_code"}}</a>

templates/user/auth/signin_inner.tmpl

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,20 @@
99
{{end}}
1010
</h4>
1111
<div class="ui attached segment">
12-
<form class="ui form" action="{{.SignInLink}}" method="post">
12+
<form class="ui form tw-max-w-2xl tw-m-auto" action="{{.SignInLink}}" method="post">
1313
{{.CsrfTokenHtml}}
14-
<div class="required inline field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}">
14+
<div class="required field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}">
1515
<label for="user_name">{{ctx.Locale.Tr "home.uname_holder"}}</label>
1616
<input id="user_name" type="text" name="user_name" value="{{.user_name}}" autofocus required>
1717
</div>
1818
{{if or (not .DisablePassword) .LinkAccountMode}}
19-
<div class="required inline field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}">
19+
<div class="required field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}">
2020
<label for="password">{{ctx.Locale.Tr "password"}}</label>
2121
<input id="password" name="password" type="password" value="{{.password}}" autocomplete="current-password" required>
2222
</div>
2323
{{end}}
2424
{{if not .LinkAccountMode}}
2525
<div class="inline field">
26-
<label></label>
2726
<div class="ui checkbox">
2827
<label>{{ctx.Locale.Tr "auth.remember_me"}}</label>
2928
<input name="remember" type="checkbox">
@@ -33,8 +32,7 @@
3332

3433
{{template "user/auth/captcha" .}}
3534

36-
<div class="inline field">
37-
<label></label>
35+
<div class="field">
3836
<button class="ui primary button">
3937
{{if .LinkAccountMode}}
4038
{{ctx.Locale.Tr "auth.oauth_signin_submit"}}
@@ -46,8 +44,7 @@
4644
</div>
4745

4846
{{if .ShowRegistrationButton}}
49-
<div class="inline field">
50-
<label></label>
47+
<div class="field">
5148
<a href="{{AppSubUrl}}/user/sign_up">{{ctx.Locale.Tr "auth.sign_up_now"}}</a>
5249
</div>
5350
{{end}}
@@ -60,7 +57,7 @@
6057
<div class="gt-df gt-fc gt-jc">
6158
<div id="oauth2-login-navigator-inner" class="gt-df gt-fc gt-fw gt-ac gt-gap-3">
6259
{{range $provider := .OAuth2Providers}}
63-
<a class="{{$provider.Name}} ui button gt-df gt-ac gt-jc gt-py-3 oauth-login-link" href="{{AppSubUrl}}/user/oauth2/{{$provider.DisplayName}}">
60+
<a class="{{$provider.Name}} ui button gt-df gt-ac gt-jc gt-py-3 tw-w-full oauth-login-link" href="{{AppSubUrl}}/user/oauth2/{{$provider.DisplayName}}">
6461
{{$provider.IconHTML 28}}
6562
{{ctx.Locale.Tr "sign_in_with_provider" $provider.DisplayName}}
6663
</a>

templates/user/auth/signin_openid.tmpl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,25 @@
88
OpenID
99
</h4>
1010
<div class="ui attached segment">
11-
<form class="ui form" action="{{.Link}}" method="post">
11+
<form class="ui form tw-m-auto" action="{{.Link}}" method="post">
1212
{{.CsrfTokenHtml}}
1313
<div class="inline field">
1414
{{ctx.Locale.Tr "auth.openid_signin_desc"}}
1515
</div>
16-
<div class="required inline field {{if .Err_OpenID}}error{{end}}">
16+
<div class="required field {{if .Err_OpenID}}error{{end}}">
1717
<label for="openid">
1818
{{svg "fontawesome-openid"}}
1919
OpenID URI
2020
</label>
2121
<input id="openid" name="openid" value="{{.openid}}" autofocus required>
2222
</div>
2323
<div class="inline field">
24-
<label></label>
2524
<div class="ui checkbox">
2625
<label>{{ctx.Locale.Tr "auth.remember_me"}}</label>
2726
<input name="remember" type="checkbox">
2827
</div>
2928
</div>
3029
<div class="inline field">
31-
<label></label>
3230
<button class="ui primary button">{{ctx.Locale.Tr "sign_in"}}</button>
3331
</div>
3432
</form>

templates/user/auth/signup_inner.tmpl

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,29 @@
77
{{end}}
88
</h4>
99
<div class="ui attached segment">
10-
<form class="ui form" action="{{.SignUpLink}}" method="post">
10+
<form class="ui form tw-max-w-2xl tw-m-auto" action="{{.SignUpLink}}" method="post">
1111
{{.CsrfTokenHtml}}
1212
{{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister)}}
1313
{{template "base/alert" .}}
1414
{{end}}
1515
{{if .DisableRegistration}}
1616
<p>{{ctx.Locale.Tr "auth.disable_register_prompt"}}</p>
1717
{{else}}
18-
<div class="required inline field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
18+
<div class="required field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
1919
<label for="user_name">{{ctx.Locale.Tr "username"}}</label>
2020
<input id="user_name" type="text" name="user_name" value="{{.user_name}}" autofocus required>
2121
</div>
22-
<div class="required inline field {{if .Err_Email}}error{{end}}">
22+
<div class="required field {{if .Err_Email}}error{{end}}">
2323
<label for="email">{{ctx.Locale.Tr "email"}}</label>
2424
<input id="email" name="email" type="email" value="{{.email}}" required>
2525
</div>
2626

2727
{{if not .DisablePassword}}
28-
<div class="required inline field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
28+
<div class="required field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
2929
<label for="password">{{ctx.Locale.Tr "password"}}</label>
3030
<input id="password" name="password" type="password" value="{{.password}}" autocomplete="new-password" required>
3131
</div>
32-
<div class="required inline field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
32+
<div class="required field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
3333
<label for="retype">{{ctx.Locale.Tr "re_type"}}</label>
3434
<input id="retype" name="retype" type="password" value="{{.retype}}" autocomplete="new-password" required>
3535
</div>
@@ -38,7 +38,6 @@
3838
{{template "user/auth/captcha" .}}
3939

4040
<div class="inline field">
41-
<label></label>
4241
<button class="ui primary button">
4342
{{if .LinkAccountMode}}
4443
{{ctx.Locale.Tr "auth.oauth_signup_submit"}}
@@ -50,7 +49,6 @@
5049

5150
{{if not .LinkAccountMode}}
5251
<div class="inline field">
53-
<label></label>
5452
<a href="{{AppSubUrl}}/user/login">{{ctx.Locale.Tr "auth.register_helper_msg"}}</a>
5553
</div>
5654
{{end}}
@@ -64,7 +62,7 @@
6462
<div class="gt-df gt-fc gt-jc">
6563
<div id="oauth2-login-navigator-inner" class="gt-df gt-fc gt-fw gt-ac gt-gap-3">
6664
{{range $provider := .OAuth2Providers}}
67-
<a class="{{$provider.Name}} ui button gt-df gt-ac gt-jc gt-py-3 oauth-login-link" href="{{AppSubUrl}}/user/oauth2/{{$provider.DisplayName}}">
65+
<a class="{{$provider.Name}} ui button gt-df gt-ac gt-jc gt-py-3 tw-w-full oauth-login-link" href="{{AppSubUrl}}/user/oauth2/{{$provider.DisplayName}}">
6866
{{$provider.IconHTML 28}}
6967
{{ctx.Locale.Tr "sign_in_with_provider" $provider.DisplayName}}
7068
</a>

templates/user/auth/signup_openid_register.tmpl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,27 @@
77
{{ctx.Locale.Tr "auth.openid_register_title"}}
88
</h4>
99
<div class="ui attached segment">
10-
<p>
10+
<p class="tw-max-w-2xl tw-mx-auto">
1111
{{ctx.Locale.Tr "auth.openid_register_desc"}}
1212
</p>
1313
<form class="ui form" action="{{.Link}}" method="post">
1414
{{.CsrfTokenHtml}}
15-
<div class="required inline field {{if .Err_UserName}}error{{end}}">
15+
<div class="required field {{if .Err_UserName}}error{{end}}">
1616
<label for="user_name">{{ctx.Locale.Tr "username"}}</label>
1717
<input id="user_name" type="text" name="user_name" value="{{.user_name}}" autofocus required>
1818
</div>
19-
<div class="required inline field {{if .Err_Email}}error{{end}}">
19+
<div class="required field {{if .Err_Email}}error{{end}}">
2020
<label for="email">{{ctx.Locale.Tr "email"}}</label>
2121
<input id="email" name="email" type="email" value="{{.email}}" required>
2222
</div>
2323

2424
{{template "user/auth/captcha" .}}
2525

26-
<div class="inline field">
26+
<div class="field">
2727
<label for="openid">OpenID URI</label>
2828
<input id="openid" value="{{.OpenID}}" readonly>
2929
</div>
3030
<div class="inline field">
31-
<label></label>
3231
<button class="ui primary button">{{ctx.Locale.Tr "auth.create_new_account"}}</button>
3332
</div>
3433
</form>

templates/user/auth/twofa.tmpl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@
22
<div role="main" aria-label="{{.Title}}" class="page-content user signin">
33
<div class="ui middle very relaxed page grid">
44
<div class="column">
5-
<form class="ui form" action="{{.Link}}" method="post">
5+
<form class="ui form tw-max-w-2xl tw-m-auto" action="{{.Link}}" method="post">
66
{{.CsrfTokenHtml}}
77
<h3 class="ui top attached header">
88
{{ctx.Locale.Tr "twofa"}}
99
</h3>
1010
<div class="ui attached segment">
1111
{{template "base/alert" .}}
12-
<div class="required inline field">
12+
<div class="required field">
1313
<label for="passcode">{{ctx.Locale.Tr "passcode"}}</label>
1414
<input id="passcode" name="passcode" type="text" autocomplete="one-time-code" inputmode="numeric" pattern="[0-9]*" autofocus required>
1515
</div>
1616

1717
<div class="inline field">
18-
<label></label>
1918
<button class="ui primary button">{{ctx.Locale.Tr "auth.verify"}}</button>
2019
<a href="{{AppSubUrl}}/user/two_factor/scratch">{{ctx.Locale.Tr "auth.use_scratch_code"}}</a>
2120
</div>

templates/user/auth/twofa_scratch.tmpl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@
22
<div role="main" aria-label="{{.Title}}" class="page-content user signin">
33
<div class="ui middle very relaxed page grid">
44
<div class="column">
5-
<form class="ui form" action="{{.Link}}" method="post">
5+
<form class="ui form tw-max-w-2xl tw-m-auto" action="{{.Link}}" method="post">
66
{{.CsrfTokenHtml}}
77
<h3 class="ui top attached header">
88
{{ctx.Locale.Tr "twofa_scratch"}}
99
</h3>
1010
<div class="ui attached segment">
1111
{{template "base/alert" .}}
12-
<div class="required inline field">
12+
<div class="required field">
1313
<label for="token">{{ctx.Locale.Tr "auth.scratch_code"}}</label>
1414
<input id="token" name="token" type="text" autocomplete="off" autofocus required>
1515
</div>
1616

1717
<div class="inline field">
18-
<label></label>
1918
<button class="ui primary button">{{ctx.Locale.Tr "auth.verify"}}</button>
2019
</div>
2120
</div>

web_src/css/form.css

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,8 @@ textarea:focus,
239239
}
240240
}
241241

242-
.user.activate form,
243242
.user.forgot.password form,
244243
.user.reset.password form,
245-
.user.link-account form,
246-
.user.signin form,
247244
.user.signup form {
248245
margin: auto;
249246
width: 700px !important;
@@ -275,12 +272,7 @@ textarea:focus,
275272
.user.signup form .header {
276273
padding-left: 280px !important;
277274
}
278-
.user.activate form .inline.field > label,
279-
.user.forgot.password form .inline.field > label,
280-
.user.reset.password form .inline.field > label,
281-
.user.link-account form .inline.field > label,
282-
.user.signin form .inline.field > label,
283-
.user.signup form .inline.field > label {
275+
.user.activate form .inline.field > label {
284276
text-align: right;
285277
width: 250px !important;
286278
word-wrap: break-word;

0 commit comments

Comments
 (0)