Skip to content

Commit 157b6bf

Browse files
committed
Fix: OIDC callback
1 parent 5694c08 commit 157b6bf

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

coderd/userauth.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,20 @@ func (api *API) oauthLogin(r *http.Request, params *oauthLoginParams) ([]*http.C
13051305
}
13061306
}
13071307

1308+
// Activate dormant user on sigin
1309+
if user.Status == database.UserStatusDormant {
1310+
//nolint:gocritic // System needs to update status of the user account (dormant -> active).
1311+
user, err = tx.UpdateUserStatus(dbauthz.AsSystemRestricted(ctx), database.UpdateUserStatusParams{
1312+
ID: user.ID,
1313+
Status: database.UserStatusActive,
1314+
UpdatedAt: database.Now(),
1315+
})
1316+
if err != nil {
1317+
logger.Error(ctx, "unable to update user status to active", slog.Error(err))
1318+
return xerrors.Errorf("update user status: %w", err)
1319+
}
1320+
}
1321+
13081322
if link.UserID == uuid.Nil {
13091323
//nolint:gocritic
13101324
link, err = tx.InsertUserLink(dbauthz.AsSystemRestricted(ctx), database.InsertUserLinkParams{

0 commit comments

Comments
 (0)