aboutsummaryrefslogtreecommitdiff
path: root/src/routes/index.js
diff options
context:
space:
mode:
authorAkshay" (aider) <[email protected]>2024-11-09 09:58:33 +0000
committerAkshay" (aider) <[email protected]>2024-11-09 09:58:33 +0000
commitd61ae0d7767e6e449665e75a4b0087df5a863973 (patch)
tree516ab6208b45f8dab91690b748f36f32a632642b /src/routes/index.js
parent5717b7f2e65826f8654e796e075008d16b0913f7 (diff)
fix: Redirect register and login pages to home on success
Diffstat (limited to 'src/routes/index.js')
-rw-r--r--src/routes/index.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/routes/index.js b/src/routes/index.js
index 2ee97e3..ec618c8 100644
--- a/src/routes/index.js
+++ b/src/routes/index.js
@@ -90,7 +90,7 @@ router.post("/register", async (req, res) => {
90 username, 90 username,
91 password, 91 password,
92 ]).run(); 92 ]).run();
93 res.status(201).send("User registered successfully"); 93 res.status(201).redirect("/");
94 } catch (err) { 94 } catch (err) {
95 console.log(err); 95 console.log(err);
96 res.status(400).send("Error registering user"); 96 res.status(400).send("Error registering user");
@@ -107,7 +107,7 @@ router.post("/login", async (req, res) => {
107 ]) 107 ])
108 .get(); 108 .get();
109 if (user) { 109 if (user) {
110 res.status(200).send("Login successful"); 110 res.status(200).redirect("/");
111 } else { 111 } else {
112 res.status(401).send("Invalid credentials"); 112 res.status(401).send("Invalid credentials");
113 } 113 }