Skip to content

Commit

Permalink
Reattempt oauth2 registration on login if registration failed
Browse files Browse the repository at this point in the history
If OAuth2 registration fails at startup we currently disable the
login_source however an alternative approach could be to reattempt
registration on login attempt.

Fix go-gitea#16096

Signed-off-by: Andrew Thornton <[email protected]>
  • Loading branch information
zeripath committed Jul 28, 2021
1 parent 73c03f5 commit b1e452d
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions models/oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,6 @@ func initOAuth2LoginSources() error {
err := oauth2.RegisterProvider(source.Name, oAuth2Config.Provider, oAuth2Config.ClientID, oAuth2Config.ClientSecret, oAuth2Config.OpenIDConnectAutoDiscoveryURL, oAuth2Config.CustomURLMapping)
if err != nil {
log.Critical("Unable to register source: %s due to Error: %v. This source will be disabled.", source.Name, err)
source.IsActived = false
if err = UpdateSource(source); err != nil {
log.Critical("Unable to update source %s to disable it. Error: %v", err)
return err
}
}
}
return nil
Expand Down

0 comments on commit b1e452d

Please sign in to comment.