Fix bug where form was posting to the wrong path
Signed-off-by: Margo Crawford <margaretc@vmware.com>
This commit is contained in:
parent
69e5169fc5
commit
388cdb6ddd
@ -28,6 +28,7 @@ type PageData struct {
|
||||
HasAlertError bool
|
||||
AlertMessage string
|
||||
Title string
|
||||
PostPath string
|
||||
}
|
||||
|
||||
func NewGetHandler(upstreamIDPs oidc.UpstreamIdentityProvidersLister) HandlerFunc {
|
||||
@ -44,6 +45,7 @@ func NewGetHandler(upstreamIDPs oidc.UpstreamIdentityProvidersLister) HandlerFun
|
||||
HasAlertError: alertError != "",
|
||||
AlertMessage: message,
|
||||
Title: "Pinniped",
|
||||
PostPath: r.URL.Path, // the path for POST is the same as for GET
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -98,7 +98,7 @@ func TestGetLogin(t *testing.T) {
|
||||
tt := test
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
handler := NewGetHandler(tt.idps)
|
||||
target := "/login?state=" + tt.encodedState
|
||||
target := "/some/path/login?state=" + tt.encodedState
|
||||
if tt.errParam != "" {
|
||||
target += "&err=" + tt.errParam
|
||||
}
|
||||
@ -126,7 +126,7 @@ func getHTMLResult(errorBanner string) string {
|
||||
<h1>Pinniped</h1>
|
||||
<p>some-ldap-idp</p>
|
||||
%s
|
||||
<form action="/login" method="post">
|
||||
<form action="/some/path/login" method="post" target="_parent">
|
||||
|
||||
<div>
|
||||
<label for="username"><b>Username</b></label>
|
||||
|
@ -15,7 +15,7 @@ SPDX-License-Identifier: Apache-2.0
|
||||
<span>{{.AlertMessage}}</span>
|
||||
</div>
|
||||
{{end}}
|
||||
<form action="/login" method="post">
|
||||
<form action="{{.PostPath}}" method="post" target="_parent">
|
||||
|
||||
<div>
|
||||
<label for="username"><b>Username</b></label>
|
||||
|
Loading…
Reference in New Issue
Block a user