diff --git a/internal/api/ui/login/login_handler.go b/internal/api/ui/login/login_handler.go
index 31f16b8555..ae21d84d87 100644
--- a/internal/api/ui/login/login_handler.go
+++ b/internal/api/ui/login/login_handler.go
@@ -95,7 +95,7 @@ func (l *Login) renderLogin(w http.ResponseWriter, r *http.Request, authReq *dom
if err != nil {
errID, errMessage = l.getErrorMessage(r, err)
}
- if singleIDPAllowed(authReq) {
+ if err == nil && singleIDPAllowed(authReq) {
l.handleIDP(w, r, authReq, authReq.AllowedExternalIDPs[0].IDPConfigID)
return
}
diff --git a/internal/api/ui/login/static/templates/login.html b/internal/api/ui/login/static/templates/login.html
index 72837c7f97..7c063d9912 100644
--- a/internal/api/ui/login/static/templates/login.html
+++ b/internal/api/ui/login/static/templates/login.html
@@ -36,7 +36,9 @@
+ {{if hasUsernamePasswordLogin}}
+ {{end}}
{{if hasRegistration}}