feat(ui): provide ability to add a warning message to the registration/login screens (#12597)

Example for how that would look like on code.forgejo.org:

![img](/attachments/eff849d5-4269-4c26-b742-b525de7709d1)

Login screen examples:

|![1](/attachments/78c23389-7bbd-490d-967a-da87d451c199)|![2](/attachments/c4693cd3-2616-4396-92e3-f22dbe8a0103)|
|-|-|

Many instances would benefit from being able to communicate such information before a user signs up or logs in after a long break.

## Testing

Disabled unless admin explicitly decides to create a template override, nothing to test.

In theory CSS could break but IDK how to test against that given the custom template requirement.

Also need to know that template customizations are provided as-is and shift all accountability of maintaining them to admins.

## Documentation

https://codeberg.org/forgejo/docs/pulls/1945

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12597
Reviewed-by: Robert Wolff <mahlzahn@posteo.de>
Reviewed-by: Beowulf <beowulf@beocode.eu>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
0ko 2026-05-21 06:04:41 +02:00
commit 9a2ae75a43
4 changed files with 16 additions and 1 deletions

View file

@ -0,0 +1,6 @@
{{/* Uncomment to use this example in your login screen */}}
{{/*
<div class="ui warning message tw-flex tw-mb-4 tw-text-start">
<p>This instance is being used for community development of SomeGreatSoftwareName and software within its ecosystem. Unrelated repositories will be removed.</p>
</div>
*/}}

View file

@ -0,0 +1,6 @@
{{/* Uncomment to use this example in your registration form */}}
{{/*
<div class="ui warning message tw-flex tw-mt-0 tw-mb-4 tw-text-start">
<p>This instance is being used for community development of SomeGreatSoftwareName and software within its ecosystem. Unrelated repositories will be removed.</p>
</div>
*/}}

View file

@ -11,7 +11,7 @@
</h4>
<div class="ui attached segment">
{{if .EnableInternalSignIn}}
<form class="ui form" action="{{.SignInLink}}" method="post">
<form class="ui form tw-mb-4" action="{{.SignInLink}}" method="post">
<div class="required field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeSignIn))}}error{{end}}">
<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 autocorrect="off" autocapitalize="none">
@ -45,6 +45,8 @@
</form>
{{end}}
{{template "custom/signin_mid"}}
{{template "user/auth/oauth_container" .}}
</div>
</div>

View file

@ -14,6 +14,7 @@
{{if .DisableRegistration}}
<p>{{.DisableRegistrationReason}}</p>
{{else}}
{{template "custom/signup_top"}}
<div class="required field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
<label for="user_name">{{ctx.Locale.Tr "username"}}</label>
<input id="user_name" type="text" name="user_name" value="{{.user_name}}" autofocus required autocorrect="off" autocapitalize="none">