diff --git a/public/app.css b/public/app.css index 49d02c2..e70fa04 100644 --- a/public/app.css +++ b/public/app.css @@ -170,4 +170,8 @@ body:not(.index) .page-title { margin: 0; background: none; color: var(--color-text); -} \ No newline at end of file +} + +.error-message { + color: var(--color-danger); +} diff --git a/public/base.css b/public/base.css index 7217e32..7bd5904 100644 --- a/public/base.css +++ b/public/base.css @@ -22,6 +22,7 @@ --color-positive: var(--color-teal); --color-negative: var(--color-pink); --color-border: #DBDBDC; + --color-danger: #F00; --space-xs: 0.25em; --space-s: 0.5em; --space-m: 1em; diff --git a/server.js b/server.js index c12b838..e88ac7c 100644 --- a/server.js +++ b/server.js @@ -116,6 +116,11 @@ app.get("/signin", (request, response) => { }) app.post("/signin", upload.none(), (request, response) => { + if (! request.body.name) { + response.status(422).render("signin", { title: "Sign In", error: true }) + return; + } + // Cookie expires in one day const expiration = new Date(Date.now() + 86400000) diff --git a/views/signin.ejs b/views/signin.ejs index d79d9fa..8004cb2 100644 --- a/views/signin.ejs +++ b/views/signin.ejs @@ -3,5 +3,8 @@