Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: Ignore deleted users when signing up with OAuth
This prevented a deleted user from signing up again when they
were already linked with a previous account.
  • Loading branch information
kylecarbs committed Sep 13, 2022
commit dacfbd7c4e1f7003893b0fa4cd225e0cc024372d
6 changes: 5 additions & 1 deletion coderd/userauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down