fix(auth): a GitHub account someone has is theirs to switch to where passwords are offered too
Linking refused every GitHub account with `deprecated` where people sign in with a password, before asking whether the account was someone else's. An anonymous person tapping Sign in with GitHub, whose app links first and switches to the account's person when it is taken, so never got to the switch: the end-to-end test of 21 Oct found it. Nothing is linked either way; the account someone has is said to be theirs first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
90e29c2f4c
commit
562d334e6e
1 changed files with 26 additions and 6 deletions
|
|
@ -208,7 +208,10 @@ Future<String> verifiedGitHubUserId(
|
|||
/// nothing changed, when the account belongs to someone else or the person
|
||||
/// has another GitHub account, and wherever people sign in with a password
|
||||
/// (ADR 0017: GitHub is deprecated, [GitHubSignInRefusal.deprecated])
|
||||
/// ([GitHubSignInRefusedException]).
|
||||
/// ([GitHubSignInRefusedException]). An account someone else has is said to
|
||||
/// be so there too, as nothing would be linked: an anonymous person's app
|
||||
/// then switches to it (`gitHubSignIn.signIn`), which still signs in those
|
||||
/// who have one.
|
||||
Future<void> linkGitHubAccount(
|
||||
Session session, {
|
||||
required UuidValue authUserId,
|
||||
|
|
@ -229,16 +232,16 @@ Future<void> linkGitHubAccount(
|
|||
)) {
|
||||
return;
|
||||
}
|
||||
if (passwordSignInAvailable(session.serverpod)) {
|
||||
throw GitHubSignInRefusedException(
|
||||
reason: GitHubSignInRefusal.deprecated,
|
||||
);
|
||||
}
|
||||
if (accounts.any((account) => account.userIdentifier == gitHubUserId)) {
|
||||
throw GitHubSignInRefusedException(
|
||||
reason: GitHubSignInRefusal.takenByAnotherPerson,
|
||||
);
|
||||
}
|
||||
if (passwordSignInAvailable(session.serverpod)) {
|
||||
throw GitHubSignInRefusedException(
|
||||
reason: GitHubSignInRefusal.deprecated,
|
||||
);
|
||||
}
|
||||
if (accounts.isNotEmpty) {
|
||||
throw GitHubSignInRefusedException(
|
||||
reason: GitHubSignInRefusal.otherGitHubAccountLinked,
|
||||
|
|
|
|||
Loading…
Reference in a new issue