forgejo/services
Gusted a9c97110f9 feat: add configurable cooldown to claim usernames (#6422)
Add a new option that allows instances to set a cooldown period to claim
old usernames. In the context of public instances this can be used to
prevent old usernames to be claimed after they are free and allow
graceful migration (by making use of the redirect feature) to a new
username. The granularity of this cooldown is a day. By default this
feature is disabled and thus no cooldown period.

The `CreatedUnix` column is added the `user_redirect` table, for
existing redirects the timestamp is simply zero as we simply do not know
when they were created and are likely already over the cooldown period
if the instance configures one.

Users can always reclaim their 'old' user name again within the cooldown
period. Users can also always reclaim 'old' names of organization they
currently own within the cooldown period.

Creating and renaming users as an admin user are not affected by the
cooldown period for moderation and user support reasons.

To avoid abuse of the cooldown feature, such that a user holds a lot of
usernames, a new option is added `MAX_USER_REDIRECTS` which sets a limit
to the amount of user redirects a user may have, by default this is
disabled. If a cooldown period is set then the default is 5. This
feature operates independently of the cooldown period feature.

Added integration and unit testing.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6422
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-01-24 04:16:56 +00:00
..
actions Add search action jobs for API routes, repo, org and global level (#6300) 2025-01-14 11:17:42 +00:00
agit fix(agit): run full pr checks on force-push 2024-08-12 09:00:41 +02:00
asymkey tests: improve actvititypub integration test code 2024-11-01 22:39:49 +01:00
attachment tests: improve actvititypub integration test code 2024-11-01 22:39:49 +01:00
auth [PORT] Remove SHA1 for support for ssh rsa signing (#31857) (#5303) 2025-01-17 03:17:10 +00:00
automerge Add branch auto deletion for scheduled PRs 2024-10-31 03:49:15 +01:00
context Rewrite OpenGraph Header 2025-01-01 20:43:20 +01:00
contexttest [TESTS] Fix usage of LoadRepoCommit 2024-08-26 08:03:48 +02:00
convert Merge pull request '[gitea] week 2024-52 cherry pick (gitea/main -> forgejo)' (#6342) from earl-warren/wcp/2024-52 into forgejo 2024-12-24 06:28:36 +00:00
cron Clear up old Actions logs (#31735) 2024-08-04 18:24:10 +02:00
doctor fix: teach the doctor about orphaned two_factor rows (#6639) 2025-01-21 17:30:08 +00:00
externalaccount fix: Revert "allow synchronizing user status from OAuth2 login providers (#31572)" 2024-12-12 05:59:06 +01:00
f3 fix: f3: label color must start with # 2025-01-07 17:13:21 +01:00
federation feat: access ActivityPub client through interfaces to facilitate mocking in unit tests (#4853) 2024-08-07 05:45:24 +00:00
feed tests: improve actvititypub integration test code 2024-11-01 22:39:49 +01:00
forgejo tests: improve actvititypub integration test code 2024-11-01 22:39:49 +01:00
forms Alt Linux Apt-Rpm repository support for Forgejo packages. (#6351) 2025-01-22 14:01:49 +00:00
gitdiff improve performance of diffs (#32393) 2024-11-05 09:39:21 +01:00
indexer Update issue indexer after merging a PR (#30715) 2024-05-12 20:03:10 +02:00
issue demilestone should not include milestone (#32923) 2024-12-28 19:24:24 +00:00
lfs Fix missing signature key error when pulling Docker images with SERVE_DIRECT enabled (#32365) 2024-11-05 09:33:15 +01:00
mailer Improve usage of HMAC output for mailer tokens 2024-11-15 10:59:36 +01:00
markup Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
migrations feat: implement migration of website field from gogs/gitea/github (#6474) 2025-01-20 12:18:19 +00:00
mirror [gitea] week 2025-03 cherry pick (gitea/main -> forgejo) (#6539) 2025-01-17 01:58:00 +00:00
notify Clean up log messages (#30313) 2024-04-15 20:01:35 +02:00
org Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
packages Release-note and file rename for Alt Linux Apt-RPM support (#6656) 2025-01-23 07:22:05 +00:00
pull Fix duplicate co-author in squashed merge commit messages (#33020) 2025-01-05 12:15:51 +00:00
release Trim title before insert/update to database to match the size requirements of database (#32498) 2024-11-17 12:18:56 +01:00
remote Enable unparam linter (#31277) 2024-06-16 13:42:58 +02:00
repository feat: implement migration of website field from gogs/gitea/github (#6474) 2025-01-20 12:18:19 +00:00
secrets Refactor deletion (#28610) 2023-12-25 21:25:29 +01:00
shared/automerge create "shared" package to workaround import loop issues 2024-10-31 03:49:14 +01:00
task feat(quota): Quota enforcement 2024-08-02 11:10:34 +02:00
uinotification Penultimate round of db.DefaultContext refactor (#27414) 2023-10-11 04:24:07 +00:00
user feat: add configurable cooldown to claim usernames (#6422) 2025-01-24 04:16:56 +00:00
webhook Test webhook email (#33033) 2025-01-05 12:00:26 +00:00
wiki Show page titles in wiki search results (#6048) 2024-11-24 15:55:34 +01:00