1
1
mirror of https://github.com/go-gitea/gitea synced 2025-08-01 23:28:36 +00:00

Fix creation OAuth2 auth source from CLI. (#14146)

Fix #8356
This commit is contained in:
Daniil Pankratov
2020-12-25 15:02:52 +03:00
committed by GitHub
parent bf1441b1e1
commit 205be63bc1
3 changed files with 27 additions and 3 deletions

View File

@@ -570,8 +570,17 @@ func SignInOAuth(ctx *context.Context) {
return
}
err = oauth2.Auth(loginSource.Name, ctx.Req.Request, ctx.Resp)
if err != nil {
if err = oauth2.Auth(loginSource.Name, ctx.Req.Request, ctx.Resp); err != nil {
if strings.Contains(err.Error(), "no provider for ") {
if err = models.ResetOAuth2(); err != nil {
ctx.ServerError("SignIn", err)
return
}
if err = oauth2.Auth(loginSource.Name, ctx.Req.Request, ctx.Resp); err != nil {
ctx.ServerError("SignIn", err)
}
return
}
ctx.ServerError("SignIn", err)
}
// redirect is done in oauth2.Auth