Skip to content

Commit

Permalink
Prevent panic on prohibited user login with oauth2 (go-gitea#18562)
Browse files Browse the repository at this point in the history
Backport go-gitea#18562

There was an unfortunate regression in go-gitea#17962 where following detection of the
UserProhibitLogin error the err is cast to a pointer by mistake.

This causes a panic due to an interface error.

Fix go-gitea#18561

Signed-off-by: Andrew Thornton <[email protected]>
  • Loading branch information
zeripath committed Feb 2, 2022
1 parent 0dfe5fa commit 16d4deb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion routers/web/auth/oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ func SignInOAuthCallback(ctx *context.Context) {
u, gothUser, err := oAuth2UserLoginCallback(authSource, ctx.Req, ctx.Resp)
if err != nil {
if user_model.IsErrUserProhibitLogin(err) {
uplerr := err.(*user_model.ErrUserProhibitLogin)
uplerr := err.(user_model.ErrUserProhibitLogin)
log.Info("Failed authentication attempt for %s from %s: %v", uplerr.Name, ctx.RemoteAddr(), err)
ctx.Data["Title"] = ctx.Tr("auth.prohibit_login")
ctx.HTML(http.StatusOK, "user/auth/prohibit_login")
Expand Down

0 comments on commit 16d4deb

Please sign in to comment.