Fix wrong error highlighting on install page (#4063)

More details are in PR message.

Changes applied:

* replace `Err_Services` with more specific `Err_DisabledRegistration`
* highlight the self-registration option instead of services section

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4063
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
0ko 2024-06-11 19:05:05 +00:00
parent c35d86f976
commit c320f16a0b
2 changed files with 3 additions and 3 deletions

View file

@ -319,7 +319,7 @@ func SubmitInstall(ctx *context.Context) {
// Check logic loophole between disable self-registration and no admin account. // Check logic loophole between disable self-registration and no admin account.
if form.DisableRegistration && len(form.AdminName) == 0 { if form.DisableRegistration && len(form.AdminName) == 0 {
ctx.Data["Err_Services"] = true ctx.Data["Err_DisabledRegistration"] = true
ctx.Data["Err_Admin"] = true ctx.Data["Err_Admin"] = true
ctx.RenderWithErr(ctx.Tr("install.no_admin_and_disable_registration"), tplInstall, form) ctx.RenderWithErr(ctx.Tr("install.no_admin_and_disable_registration"), tplInstall, form)
return return

View file

@ -154,7 +154,7 @@
</div> </div>
<div class="inline field"> <div class="inline field">
<div class="ui checkbox" id="disable-registration"> <div class="ui checkbox" id="disable-registration">
<label>{{ctx.Locale.Tr "install.disable_registration"}}</label> <label class="{{if .Err_DisabledRegistration}}text red{{end}}">{{ctx.Locale.Tr "install.disable_registration"}}</label>
<input name="disable_registration" type="checkbox" {{if .disable_registration}}checked{{end}}> <input name="disable_registration" type="checkbox" {{if .disable_registration}}checked{{end}}>
</div> </div>
<span class="help">{{ctx.Locale.Tr "install.disable_registration.description"}}</span> <span class="help">{{ctx.Locale.Tr "install.disable_registration.description"}}</span>
@ -212,7 +212,7 @@
<!-- Server and other services --> <!-- Server and other services -->
<details class="collapsible optional field"> <details class="collapsible optional field">
<summary class="tw-py-2{{if .Err_Services}} text red{{end}}"> <summary class="tw-py-2">
{{ctx.Locale.Tr "install.server_service_title"}} {{ctx.Locale.Tr "install.server_service_title"}}
</summary> </summary>
<div class="inline field"> <div class="inline field">