diff options
author | zeripath <art27@cantab.net> | 2022-02-03 13:36:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-03 21:36:42 +0800 |
commit | 8d31cfbfff63d01150c131e674708ee7ed2e430d (patch) | |
tree | a12027050ff72b35fb85ff11ae76953186405ee2 | |
parent | e84a432f760e801b4541512534ba5cba1a6a90b7 (diff) | |
download | gitea-8d31cfbfff63d01150c131e674708ee7ed2e430d.tar.gz gitea-8d31cfbfff63d01150c131e674708ee7ed2e430d.zip |
Prevent panic on prohibited user login with oauth2 (#18562) (#18563)
Backport #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 <art27@cantab.net>
-rw-r--r-- | routers/web/auth/oauth.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/web/auth/oauth.go b/routers/web/auth/oauth.go index dbd1756348..8bd443a6c9 100644 --- a/routers/web/auth/oauth.go +++ b/routers/web/auth/oauth.go @@ -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") |