Skip to content

feat(reactivation): add self-service account reactivation - #154

Merged
skjnldsv merged 3 commits into
nextcloud:mainfrom
theMasix:feat/self-service-account-reactivation
Jul 1, 2026
Merged

skjnldsv merged 3 commits into
nextcloud:mainfrom
theMasix:feat/self-service-account-reactivation

Conversation

@theMasix

Copy link
Copy Markdown
Contributor

Closes #5

Summary

Users whose accounts were auto-disabled for missing the email verification window previously had no recourse other than contacting an admin. This MR adds a fully self-service reactivation flow so users can recover their accounts without support intervention.

What changed

  • ExpireUserTrait — stamps a pp_disabled=1 flag when disabling a user, so we can distinguish PP-disabled accounts from admin-disabled ones.
  • ReactivateController — new public controller with two endpoints:
    • GET /reactivate — renders the reactivation form.
    • POST /reactivate — re-enables the account, resets the verification deadline, and sends a fresh verification email. Always returns the same response regardless of whether the email matched an account, preventing email enumeration.
  • VerifyMailHelper — replaces the static "contact your provider" text in the account-disabled email with a "Reactivate your account" CTA button linking to the new form.
  • templates/reactivate-public.php — guest-layout template with two states: the email input form and a post-submission confirmation.
  • appinfo/routes.php — registers the two new public routes.

Security notes

  • The POST handler deliberately does not distinguish between "email not found" and "account found and reactivated" — the response is always the same to prevent account enumeration.
  • Only accounts flagged with pp_disabled=1 (i.e., auto-disabled by this app) can be reactivated through this flow; admin-disabled accounts are unaffected.
  • Re-enables the account and resets disable_user_after to the standard verification window before sending the new verification email.

@skjnldsv skjnldsv self-assigned this Jul 1, 2026
@skjnldsv
skjnldsv force-pushed the feat/self-service-account-reactivation branch 2 times, most recently from a12eeac to 99d3b54 Compare July 1, 2026 17:06
…cloud#5)

Users whose accounts were auto-disabled for missing the email
verification window can now reactivate themselves via a public form
at /reactivate, without needing to contact an admin.

- Mark PP-disabled accounts with a pp_disabled flag in ExpireUserTrait
- Add GET/POST /reactivate public routes and ReactivateController
- Add reactivate-public.php template (form + confirmation states)
- Replace "contact your provider" text in the deactivation email with
  a "Reactivate your account" button linking to the form

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
@skjnldsv
skjnldsv force-pushed the feat/self-service-account-reactivation branch 2 times, most recently from f6d191a to a90b2d2 Compare July 1, 2026 17:23
skjnldsv added 2 commits July 1, 2026 19:29
Adapt the rebased self-service reactivation feature to the current app
conventions and close the gaps found in review:

- ReactivateController: PHP attributes replace the removed routes.php
  (#[FrontpageRoute] GET/POST /reactivate, #[PublicPage]); constructor property
  promotion + readonly; SPDX header.
- Security: add #[NoCSRFRequired] to the POST handler (the guest form carries no
  requesttoken, so without it the CSRF middleware rejected every submission) and
  #[AnonRateLimit(limit: 3, period: 60)] to blunt mail-bombing / enumeration.
- Fix the disabled-account email CTA route name to '.reactivate.showform'.
- Clear the pp_disabled flag in the admin SettingsController::reactivate() too,
  so an admin reactivation supersedes (and does not leave) the self-service flag.
- Migration/BackfillPpDisabled repair step (registered post-migration) stamps
  pp_disabled=1 on accounts auto-disabled before this shipped. It starts from the
  small set of accounts still holding a PP verification token and flags the
  disabled ones, so cost scales with pending accounts (not total users) and it
  uses only varchar comparisons (Oracle-safe). Idempotent.

Assisted-by: ClaudeCode:claude-opus-4-8
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
…pp_disabled

Assisted-by: ClaudeCode:claude-opus-4-8
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
@skjnldsv
skjnldsv force-pushed the feat/self-service-account-reactivation branch from a90b2d2 to 1f841d7 Compare July 1, 2026 17:30
@skjnldsv
skjnldsv enabled auto-merge July 1, 2026 17:31
@skjnldsv
skjnldsv merged commit a490739 into nextcloud:main Jul 1, 2026
33 checks passed
@skjnldsv

skjnldsv commented Jul 1, 2026

Copy link
Copy Markdown
Member

Thanks for this @theMasix

@skjnldsv skjnldsv mentioned this pull request Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possibility to reactivate a deactivated account yourself

2 participants