diff --git a/routes/api.js b/routes/api.js index a39fd29..79f1a6c 100644 --- a/routes/api.js +++ b/routes/api.js @@ -241,7 +241,7 @@ router.post("/login", async (req, res) => { } }); -router.get("/verify-mail", async (req, res) => { +router.post("/verify-mail", async (req, res) => { if (!req.body.token) { res.status(400); res.json({ @@ -262,6 +262,7 @@ router.get("/verify-mail", async (req, res) => { if (result[0].verify == 0) { var data = { verify: 1, + token: randtoken.generate(64), }; conn.query( 'UPDATE users SET ? WHERE email ="' + result[0].email + '"', diff --git a/routes/index.js b/routes/index.js index 0918aad..030d04e 100644 --- a/routes/index.js +++ b/routes/index.js @@ -96,8 +96,8 @@ router.route("/logout") router.get("/verify-mail", (req, res) => { controller.verify_mail(req.query.token).then((data) => { - if (data == 200) { - res.render("pages/register-verification-success"); + if (data[0] == 200) { + res.render("pages/register-verification-completed"); } else { res.redirect("/"); }