diff --git a/coderd/userauth.go b/coderd/userauth.go index 865f2afeb90fa..58d101671cf20 100644 --- a/coderd/userauth.go +++ b/coderd/userauth.go @@ -229,13 +229,13 @@ func (api *API) userOAuth2Github(rw http.ResponseWriter, r *http.Request) { if link.LinkedID == "" { link, err = api.Database.UpdateUserLinkedID(ctx, database.UpdateUserLinkedIDParams{ UserID: user.ID, - LinkedID: githubLinkedID(ghUser), LoginType: database.LoginTypeGithub, + LinkedID: githubLinkedID(ghUser), }) if err != nil { httpapi.Write(rw, http.StatusInternalServerError, codersdk.Response{ Message: "A database error occurred.", - Detail: xerrors.Errorf("update user link: %w", err.Error).Error(), + Detail: fmt.Sprintf("update user link: %s", err.Error()), }) return } @@ -437,13 +437,13 @@ func (api *API) userOIDC(rw http.ResponseWriter, r *http.Request) { if link.LinkedID == "" { link, err = api.Database.UpdateUserLinkedID(ctx, database.UpdateUserLinkedIDParams{ UserID: user.ID, + LoginType: database.LoginTypeOIDC, LinkedID: oidcLinkedID(idToken), - LoginType: database.LoginTypeGithub, }) if err != nil { httpapi.Write(rw, http.StatusInternalServerError, codersdk.Response{ Message: "A database error occurred.", - Detail: xerrors.Errorf("update user link: %w", err.Error).Error(), + Detail: fmt.Sprintf("update user link: %s", err.Error()), }) return } @@ -477,9 +477,10 @@ func (api *API) userOIDC(rw http.ResponseWriter, r *http.Request) { // longer sign in until an administrator finds the offending built-in // user and changes their username. user, err = api.Database.UpdateUserProfile(ctx, database.UpdateUserProfileParams{ - ID: user.ID, - Email: claims.Email, - Username: claims.Username, + ID: user.ID, + Email: claims.Email, + // TODO: This should run in a transaction. + Username: user.Username, UpdatedAt: database.Now(), }) if err != nil {