fix(auth): a reset not carried out lapses a week after it took effect

The full reading's M2: a reset of the authenticators asked and forgotten
left the account to the password alone for good, and an account's reset
could be carried out a year after it was asked. Now a reset that took
effect and wasn't carried out lapses a week later, as never asked: the
password alone no longer signs in, a code still does, and asked again it
waits anew with a new mail. A reset of the authenticators carried out never
lapses (the password alone signs in until one is confirmed). The daily
pruning forgets lapsed rows (forgetLapsedResets).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-21 13:00:39 +02:00
commit 43fcc8aac2
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -11,13 +11,16 @@ import 'package:serverpod/serverpod.dart';
/// whose account the register no longer knows, daily.
class PruningFutureCall extends FutureCall {
/// Prunes one batch and logs how many people went; once GitHub sign-in
/// has ended (`GITHUB_SIGN_IN_ENDS`), forgets every GitHub ID too.
/// has ended (`GITHUB_SIGN_IN_ENDS`), forgets every GitHub ID too; and
/// forgets the resets that lapsed (ADR 0017).
Future<void> pruneAnonymousPeople(Session session) async {
final now = clock.now();
final pruned = await pruneAbandonedAnonymousPeople(session, now: now);
final gitHub = await forgetGitHubAccounts(session, now: now);
final resets = await forgetLapsedResets(session, now: now);
session.log(
'Pruned $pruned abandoned anonymous people and $gitHub GitHub IDs.',
'Pruned $pruned abandoned anonymous people, $gitHub GitHub IDs and '
'$resets lapsed resets.',
);
}