@@ -171,7 +171,7 @@ func SignInOAuthCallback(ctx *context.Context) {
171171 gothUser .RawData = make (map [string ]any )
172172 }
173173 gothUser .RawData ["__giteaAutoRegMissingFields" ] = missingFields
174- showLinkingLogin (ctx , authSource , gothUser )
174+ showLinkingLogin (ctx , authSource . ID , gothUser )
175175 return
176176 }
177177 u = & user_model.User {
@@ -192,7 +192,7 @@ func SignInOAuthCallback(ctx *context.Context) {
192192 u .IsAdmin = isAdmin .ValueOrDefault (user_service.UpdateOptionField [bool ]{FieldValue : false }).FieldValue
193193 u .IsRestricted = isRestricted .ValueOrDefault (setting .Service .DefaultUserIsRestricted )
194194
195- linkAccountData := & LinkAccountData {* authSource , gothUser }
195+ linkAccountData := & LinkAccountData {authSource . ID , gothUser }
196196 if setting .OAuth2Client .AccountLinking == setting .OAuth2AccountLinkingDisabled {
197197 linkAccountData = nil
198198 }
@@ -207,7 +207,7 @@ func SignInOAuthCallback(ctx *context.Context) {
207207 }
208208 } else {
209209 // no existing user is found, request attach or new account
210- showLinkingLogin (ctx , authSource , gothUser )
210+ showLinkingLogin (ctx , authSource . ID , gothUser )
211211 return
212212 }
213213 }
@@ -272,8 +272,8 @@ func getUserAdminAndRestrictedFromGroupClaims(source *oauth2.Source, gothUser *g
272272}
273273
274274type LinkAccountData struct {
275- AuthSource auth. Source
276- GothUser goth.User
275+ AuthSourceID int64
276+ GothUser goth.User
277277}
278278
279279func oauth2GetLinkAccountData (ctx * context.Context ) * LinkAccountData {
@@ -284,9 +284,9 @@ func oauth2GetLinkAccountData(ctx *context.Context) *LinkAccountData {
284284 return & v
285285}
286286
287- func showLinkingLogin (ctx * context.Context , authSource * auth. Source , gothUser goth.User ) {
287+ func showLinkingLogin (ctx * context.Context , authSourceID int64 , gothUser goth.User ) {
288288 if err := updateSession (ctx , nil , map [string ]any {
289- "linkAccountData" : LinkAccountData {* authSource , gothUser },
289+ "linkAccountData" : LinkAccountData {authSourceID , gothUser },
290290 }); err != nil {
291291 ctx .ServerError ("updateSession" , err )
292292 return
@@ -313,7 +313,7 @@ func oauth2UpdateAvatarIfNeed(ctx *context.Context, url string, u *user_model.Us
313313}
314314
315315func handleOAuth2SignIn (ctx * context.Context , authSource * auth.Source , u * user_model.User , gothUser goth.User ) {
316- oauth2SignInSync (ctx , authSource , u , gothUser )
316+ oauth2SignInSync (ctx , authSource . ID , u , gothUser )
317317 if ctx .Written () {
318318 return
319319 }
0 commit comments