fix: Ignore deleted users when signing up with OAuth (#4036)

This prevented a deleted user from signing up again when they
were already linked with a previous account.
This commit is contained in:
Kyle Carberry 2022-09-13 07:33:35 -05:00 committed by GitHub
parent 1ee1db9664
commit 57c7fcf27f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -518,7 +518,11 @@ func findLinkedUser(ctx context.Context, db database.Store, linkedID string, ema
if err != nil {
return database.User{}, database.UserLink{}, xerrors.Errorf("get user by id: %w", err)
}
return user, link, nil
if !user.Deleted {
return user, link, nil
}
// If the user was deleted, act as if no account link exists.
user = database.User{}
}
for _, email := range emails {