aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--internal/webui/login.go5
-rw-r--r--internal/webui/login_test.go2
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,