diff options
author | Julien Dessaux | 2021-10-17 19:26:49 +0200 |
---|---|---|
committer | Julien Dessaux | 2021-10-17 19:26:49 +0200 |
commit | 9c4f70bdeeb61478f60c0891a7f300beab8460b7 (patch) | |
tree | 79ea8523aae99d01138be747eadbde0fb2905b5f | |
parent | Updated dependencies (diff) | |
download | trains-9c4f70bdeeb61478f60c0891a7f300beab8460b7.tar.gz trains-9c4f70bdeeb61478f60c0891a7f300beab8460b7.tar.bz2 trains-9c4f70bdeeb61478f60c0891a7f300beab8460b7.zip |
Updated test case and added TODOs
-rw-r--r-- | internal/webui/login.go | 5 | ||||
-rw-r--r-- | internal/webui/login_test.go | 2 |
2 files changed, 5 insertions, 2 deletions
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, |