diff options
author | Akshay" (aider) <[email protected]> | 2024-11-08 22:35:14 +0000 |
---|---|---|
committer | Akshay" (aider) <[email protected]> | 2024-11-08 22:35:14 +0000 |
commit | c208002788791d31fa88a8dd852bbe25dab94c08 (patch) | |
tree | 1eac25e6519b20831ce46fc2555d7e9aea4a266d /src | |
parent | 864295cdb040e3ff1654d82f633ebe84c7d2559a (diff) |
feat: Add registration page with password confirmation validation
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, |