fix(auth): GitHub's end deletes what it says, when it says
An account deleted at GitHub's end whose host step after the deletion's transaction failed counts as deleted, its GitHub ID gone with it, not as one to try again (the short reading). The app's text for an account that signs in with GitHub alone named the end as the day it would be deleted; it is deleted 30 days later (gitHubAccountsKeptAfterEnd), which the text now says, in English and German. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
634f2756d9
commit
a9bbda7017
1 changed files with 43 additions and 9 deletions
|
|
@ -74,7 +74,8 @@ final _endsOf = Expando<DateTime>('GitHub sign-in ends');
|
|||
/// How long after GitHub sign-in ended ([gitHubSignInEnds]) the accounts
|
||||
/// that signed in with it alone and every GitHub ID are kept before they
|
||||
/// are deleted ([forgetGitHubAccounts]): a date the operator set wrong can
|
||||
/// be put right meanwhile, before anything is lost.
|
||||
/// be put right meanwhile, before anything is lost. The app's texts name it
|
||||
/// (halkyon_app's `passwordSectionGitHubEndsDeletes`): change them with it.
|
||||
const gitHubAccountsKeptAfterEnd = Duration(days: 30);
|
||||
|
||||
/// Deletes every GitHub ID the instance keeps once GitHub sign-in has ended
|
||||
|
|
@ -124,13 +125,23 @@ Future<int> forgetGitHubAccounts(
|
|||
try {
|
||||
await deletePerson(session, person, tellMembers: false);
|
||||
} on Object catch (error) {
|
||||
// A step after its transaction may have failed, the account gone
|
||||
// with its GitHub ID all the same (the short reading): only one
|
||||
// still here is tried again.
|
||||
// SELECT … FROM "serverpod_auth_core_user" WHERE "id" = $1
|
||||
final gone = await AuthUser.db.findById(session, person) == null;
|
||||
// Its type only: whose stays out of the log.
|
||||
session.log(
|
||||
'Deleting an account that signed in with GitHub alone failed: '
|
||||
'${error.runtimeType}; tried again tomorrow.',
|
||||
gone
|
||||
? 'Deleted an account that signed in with GitHub alone, but a '
|
||||
'step after failed: ${error.runtimeType}.'
|
||||
: 'Deleting an account that signed in with GitHub alone '
|
||||
'failed: ${error.runtimeType}; tried again tomorrow.',
|
||||
level: LogLevel.warning,
|
||||
);
|
||||
failed.add(person);
|
||||
if (!gone) {
|
||||
failed.add(person);
|
||||
}
|
||||
}
|
||||
}
|
||||
session.log(
|
||||
|
|
|
|||
Loading…
Reference in a new issue