forgejo/models/user
forgejo-backport-action 1ccd539b6c [v12.0/forgejo] fix: user activation with uppercase email address (#8386)
**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/8386
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 13:54:45 +02:00
..
fixtures Implement remote user login source and promotion to regular user 2024-04-25 13:03:49 +02:00
activitypub.go add port and schema to federation host (#7203) 2025-04-16 08:07:51 +00:00
avatar.go Return default avatar url when user id is zero rather than updating database (#34094) 2025-04-07 16:48:15 +02:00
avatar_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
badge.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
block.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
block_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
email_address.go chore(sec): unify usage of crypto/rand.Read (#7453) 2025-04-04 03:31:37 +00:00
email_address_test.go [v12.0/forgejo] fix: user activation with uppercase email address (#8386) 2025-07-02 13:54:45 +02:00
error.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
external_login_user.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
federated_user.go Federated user activity following: Isolated model changes (#8078) 2025-06-21 12:02:58 +02:00
federated_user_follower.go Federated user activity following: Isolated model changes (#8078) 2025-06-21 12:02:58 +02:00
federated_user_follower_test.go Federated user activity following: Isolated model changes (#8078) 2025-06-21 12:02:58 +02:00
federated_user_test.go Federated user activity following: Isolated model changes (#8078) 2025-06-21 12:02:58 +02:00
follow.go Federated user activity following: Isolated model changes (#8078) 2025-06-21 12:02:58 +02:00
follow_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
list.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
main_test.go chore: merge tests.AddFixtures and unittest.OverrideFixtures (#7648) 2025-04-25 09:14:33 +00:00
moderation.go feat!: Abusive content reporting (#6977) 2025-05-18 08:05:16 +00:00
must_change_password.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
openid.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
openid_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
redirect.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
redirect_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
search.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
setting.go chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02: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 Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
user.go [v12.0/forgejo] fix: user activation with uppercase email address (#8386) 2025-07-02 13:54:45 +02:00
user_repository.go Federated user activity following: Isolated model changes (#8078) 2025-06-21 12:02:58 +02:00
user_system.go fix: only send Forgejo Actions notifications to one user (#8227) 2025-06-21 12:15:38 +02:00
user_test.go Federated user activity following: Isolated model changes (#8078) 2025-06-21 12:02:58 +02:00
user_update.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00