From 9c4f70bdeeb61478f60c0891a7f300beab8460b7 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sun, 17 Oct 2021 19:26:49 +0200 Subject: Updated test case and added TODOs --- internal/webui/login.go | 5 ++++- internal/webui/login_test.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'internal') diff --git a/internal/webui/login.go b/internal/webui/login.go index 84d477f..cc48275 100644 --- a/internal/webui/login.go +++ b/internal/webui/login.go @@ -58,13 +58,16 @@ func loginHandler(e *env, w http.ResponseWriter, r *http.Request) error { if err != nil { switch e := err.(type) { case database.PasswordError: - // TODO : handle in page + // TODO log error return e case database.QueryError: + // TODO log error return e default: + // TODO log error return e } + // TODO display login form with error } token, err := e.dbEnv.CreateSession(user) if err != nil { diff --git a/internal/webui/login_test.go b/internal/webui/login_test.go index 0d661cb..212e434 100644 --- a/internal/webui/login_test.go +++ b/internal/webui/login_test.go @@ -40,7 +40,7 @@ func TestLoginHandler(t *testing.T) { input: httpTestInput{ method: http.MethodGet, path: "/login", - cookie: &http.Cookie{Name: sessionCookieName, Value: "graou"}, + cookie: &http.Cookie{Name: sessionCookieName, Value: "invalid"}, }, expect: httpTestExpect{ code: http.StatusOK, -- cgit v1.2.3