diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/routes/index.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/routes/index.js b/src/routes/index.js index 533dabf..01101f5 100644 --- a/src/routes/index.js +++ b/src/routes/index.js | |||
@@ -71,9 +71,15 @@ router.get("/media/*", async (req, res) => { | |||
71 | res.render("media", { kind, url }); | 71 | res.render("media", { kind, url }); |
72 | }); | 72 | }); |
73 | 73 | ||
74 | // POST /register | 74 | router.get("/register", async (req, res) => { |
75 | res.render("register"); | ||
76 | }); | ||
77 | |||
75 | router.post("/register", async (req, res) => { | 78 | router.post("/register", async (req, res) => { |
76 | const { username, password } = req.body; | 79 | const { username, password, confirm_password } = req.body; |
80 | if (password !== confirm_password) { | ||
81 | return res.status(400).send("Passwords do not match"); | ||
82 | } | ||
77 | try { | 83 | try { |
78 | db.run("INSERT INTO users (username, password) VALUES (?, ?)", [ | 84 | db.run("INSERT INTO users (username, password) VALUES (?, ?)", [ |
79 | username, | 85 | username, |