Skip to content

Commit 1c5afd1

Browse files
authored
Prevent panic on prohibited user login with oauth2 (#18562)
There was an unfortunate regression in #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 #18561 Signed-off-by: Andrew Thornton <[email protected]>
1 parent 104c547 commit 1c5afd1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

routers/web/auth/oauth.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ func SignInOAuthCallback(ctx *context.Context) {
822822
u, gothUser, err := oAuth2UserLoginCallback(authSource, ctx.Req, ctx.Resp)
823823
if err != nil {
824824
if user_model.IsErrUserProhibitLogin(err) {
825-
uplerr := err.(*user_model.ErrUserProhibitLogin)
825+
uplerr := err.(user_model.ErrUserProhibitLogin)
826826
log.Info("Failed authentication attempt for %s from %s: %v", uplerr.Name, ctx.RemoteAddr(), err)
827827
ctx.Data["Title"] = ctx.Tr("auth.prohibit_login")
828828
ctx.HTML(http.StatusOK, "user/auth/prohibit_login")

0 commit comments

Comments
 (0)