Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- router.post("/verify/:token", (req, res) => {
- const { token } = req.params;
- console.log(typeof req.params);
- const errors = {};
- database
- .returning(["email", "emailverified", "tokenusedbefore"])
- .from("users")
- .where({ token: token, tokenusedbefore: "f" })
- .update({ emailverified: "t", tokenusedbefore: "t" })
- .then(data => {
- console.log(data.length);
- console.log(data);
- if (data.length > 0) {
- // Return an email verified message
- res.json("Email verified! Please login to access your account");
- } else {
- database
- .select("email", "emailverified", "tokenusedbefore")
- .from("users")
- .where("token", token)
- .then(check => {
- console.log("check", check);
- if (check.length > 0) {
- console.log("check length is 0");
- }
- });
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement