summaryrefslogtreecommitdiffstats
path: root/routers/user/auth.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/user/auth.go')
-rw-r--r--routers/user/auth.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/routers/user/auth.go b/routers/user/auth.go
index acd88b364c..540a0d2f1a 100644
--- a/routers/user/auth.go
+++ b/routers/user/auth.go
@@ -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