Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eb03a25

Browse files
committed
Fix updating to when the token changes
1 parent 7eb1dc8 commit eb03a25

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

coderd/externalauth/externalauth.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -189,19 +189,19 @@ validate:
189189
return updatedAuthLink, xerrors.Errorf("update external auth link: %w", err)
190190
}
191191
externalAuthLink = updatedAuthLink
192-
}
193192

194-
// Update the associated users github.com username if the token is for github.com.
195-
if IsGithubDotComURL(c.AuthCodeURL("")) && user != nil {
196-
err = db.UpdateUserGithubComUserID(ctx, database.UpdateUserGithubComUserIDParams{
197-
ID: externalAuthLink.UserID,
198-
GithubComUserID: sql.NullInt64{
199-
Int64: user.ID,
200-
Valid: true,
201-
},
202-
})
203-
if err != nil {
204-
return externalAuthLink, xerrors.Errorf("update user github com user id: %w", err)
193+
// Update the associated users github.com username if the token is for github.com.
194+
if IsGithubDotComURL(c.AuthCodeURL("")) && user != nil {
195+
err = db.UpdateUserGithubComUserID(ctx, database.UpdateUserGithubComUserIDParams{
196+
ID: externalAuthLink.UserID,
197+
GithubComUserID: sql.NullInt64{
198+
Int64: user.ID,
199+
Valid: true,
200+
},
201+
})
202+
if err != nil {
203+
return externalAuthLink, xerrors.Errorf("update user github com user id: %w", err)
204+
}
205205
}
206206
}
207207

0 commit comments

Comments
 (0)