mirror of
https://github.com/volatiletech/authboss.git
synced 2025-01-24 05:17:10 +02:00
auth: Context-Request separation ripple
This commit is contained in:
parent
8a87d0de63
commit
c074b79798
@ -80,8 +80,8 @@ func (a *Auth) loginHandlerFunc(ctx *authboss.Context, w http.ResponseWriter, r
|
||||
)
|
||||
return a.templates.Render(ctx, w, r, tplLogin, data)
|
||||
case methodPOST:
|
||||
key, _ := ctx.FirstPostFormValue(a.PrimaryID)
|
||||
password, _ := ctx.FirstPostFormValue("password")
|
||||
key := r.FormValue(a.PrimaryID)
|
||||
password := r.FormValue("password")
|
||||
|
||||
errData := authboss.NewHTMLData(
|
||||
"error", fmt.Sprintf("invalid %s and/or password", a.PrimaryID),
|
||||
|
@ -36,13 +36,9 @@ func testSetup() (a *Auth, s *mocks.MockStorer) {
|
||||
}
|
||||
|
||||
func testRequest(ab *authboss.Authboss, method string, postFormValues ...string) (*authboss.Context, *httptest.ResponseRecorder, *http.Request, authboss.ClientStorerErr) {
|
||||
r, err := http.NewRequest(method, "", nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
sessionStorer := mocks.NewMockClientStorer()
|
||||
ctx := mocks.MockRequestContext(ab, postFormValues...)
|
||||
ctx := ab.NewContext()
|
||||
r := mocks.MockRequest(method, postFormValues...)
|
||||
ctx.SessionStorer = sessionStorer
|
||||
|
||||
return ctx, httptest.NewRecorder(), r, sessionStorer
|
||||
|
Loading…
x
Reference in New Issue
Block a user