forgejo/models/user
forgejo-backport-action c0d11a365f [v11.0/forgejo] fix: user activation with uppercase email address (#8385)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/8367

- Right before the call to user email activation, the user is updated [^1]. This causes the email to be lowered, which in turn makes the call to activate the user activation fail (on database where collation is case sensitive, which is the recommend collation by Forgejo).
- The code in `BeforeUpdate` is quite confusing, the comment has become slightly out of date and was reworded to reflect reality and its purpose. The code is also slightly reworked to only lower the email for the `AvatarEmail` field to avoid causing side-effect.
- Added unit test.
- Resolves forgejo/forgejo#8354

[^1]: 4927d4ee3d/routers/web/auth/auth.go (L785)

Co-authored-by: Gusted <postmaster@gusted.xyz>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8385
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
2025-07-02 14:09:24 +02:00
..
fixtures Implement remote user login source and promotion to regular user 2024-04-25 13:03:49 +02:00
avatar.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
avatar_test.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
badge.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
block.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
block_test.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
email_address.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
email_address_test.go [v11.0/forgejo] fix: user activation with uppercase email address (#8385) 2025-07-02 14:09:24 +02:00
error.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
external_login_user.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
federated_user.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
federated_user_test.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
follow.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
follow_test.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
list.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
main_test.go [v11.0/forgejo] chore: merge tests.AddFixtures and unittest.OverrideFixtures (#7649) 2025-04-25 09:59:30 +00:00
must_change_password.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
openid.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
openid_test.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
redirect.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
redirect_test.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
search.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
setting.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
setting_keys.go Add codespell support and fix a good number of typos with its help (#3270) 2024-05-09 13:49:37 +00:00
setting_test.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
user.go [v11.0/forgejo] fix: user activation with uppercase email address (#8385) 2025-07-02 14:09:24 +02:00
user_repository.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
user_system.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00
user_test.go [v11.0/forgejo] fix: replace ß with ss in normalizeUserName (#7821) 2025-05-16 13:39:24 +00:00
user_update.go [v11.0/forgejo] chore: branding import path (#7354) 2025-03-27 20:13:05 +00:00