Fixed verify mail

This commit is contained in:
Moe Poi ~ 2021-11-21 11:37:38 +07:00
parent a9d1f8e9ee
commit 2309e319f5
2 changed files with 4 additions and 3 deletions

View file

@ -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 + '"',

View file

@ -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("/");
}