Skip to content

Commit 22351a5

Browse files
committed
fix
1 parent 279473f commit 22351a5

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

options/locale/locale_en-US.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ oauth_signup_submit = Complete Account
457457
oauth_signin_tab = Link to Existing Account
458458
oauth_signin_title = Sign In to Authorize Linked Account
459459
oauth_signin_submit = Link Account
460-
oauth.signin.error = There was an error processing the authorization request. If this error persists, please contact the site administrator.
460+
oauth.signin.error.general = There was an error processing the authorization request: %s. If this error persists, please contact the site administrator.
461461
oauth.signin.error.access_denied = The authorization request was denied.
462462
oauth.signin.error.temporarily_unavailable = Authorization failed because the authentication server is temporarily unavailable. Please try again later.
463463
oauth_callback_unable_auto_reg = Auto Registration is enabled, but OAuth2 Provider %[1]s returned missing fields: %[2]s, unable to create an account automatically, please create or link to an account, or contact the site administrator.

routers/web/auth/oauth.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func SignInOAuthCallback(ctx *context.Context) {
115115
case "temporarily_unavailable":
116116
ctx.Flash.Error(ctx.Tr("auth.oauth.signin.error.temporarily_unavailable"))
117117
default:
118-
ctx.Flash.Error(ctx.Tr("auth.oauth.signin.error"))
118+
ctx.Flash.Error(ctx.Tr("auth.oauth.signin.error.general", callbackErr.Description))
119119
}
120120
ctx.Redirect(setting.AppSubURL + "/user/login")
121121
return
@@ -431,8 +431,10 @@ func oAuth2UserLoginCallback(ctx *context.Context, authSource *auth.Source, requ
431431
gothUser, err := oauth2Source.Callback(request, response)
432432
if err != nil {
433433
if err.Error() == "securecookie: the value is too long" || strings.Contains(err.Error(), "Data too long") {
434-
log.Error("OAuth2 Provider %s returned too long a token. Current max: %d. Either increase the [OAuth2] MAX_TOKEN_LENGTH or reduce the information returned from the OAuth2 provider", authSource.Name, setting.OAuth2.MaxTokenLength)
435434
err = fmt.Errorf("OAuth2 Provider %s returned too long a token. Current max: %d. Either increase the [OAuth2] MAX_TOKEN_LENGTH or reduce the information returned from the OAuth2 provider", authSource.Name, setting.OAuth2.MaxTokenLength)
435+
log.Error("oauth2Source.Callback failed: %v", err)
436+
} else {
437+
err = errCallback{Code: "internal", Description: err.Error()}
436438
}
437439
return nil, goth.User{}, err
438440
}

0 commit comments

Comments
 (0)