mirror of
https://gitlab.com/nekoya/web.git
synced 2024-11-10 00:16:21 +01:00
Update verify mail
This commit is contained in:
parent
e1c0a2dea4
commit
7b808c5ea5
3 changed files with 19 additions and 4 deletions
|
@ -56,9 +56,16 @@ function login(email, password, ua, ip) {
|
|||
.catch(error => [error.status, []])
|
||||
}
|
||||
|
||||
function verify_mail(token) {
|
||||
return axios.get(HOST + '/verify-mail', { params: { token: token } })
|
||||
.then(response => response.status)
|
||||
.catch(error => console.log(error))
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getProducts,
|
||||
getProduct,
|
||||
register,
|
||||
login
|
||||
login,
|
||||
verify_mail
|
||||
}
|
|
@ -76,7 +76,7 @@ router.post('/register', async (req, res) => {
|
|||
var token = randtoken.generate(20);
|
||||
if (result[0].verify == 0) {
|
||||
let subject = "Account Verification - Nekoya";
|
||||
let content = `<p>Hello!!! Please click this link <a href="${config.host}/verify-email?token=${token}">link</a> to verify your account!!! Thanks!!!</p>`;
|
||||
let content = `<p>Hello!!! Please click this link <a href="${config.host}/verify-mail?token=${token}">link</a> to verify your account!!! Thanks!!!</p>`;
|
||||
var sent = mail.send(req.body.email, subject, content);
|
||||
if (sent != "0") {
|
||||
var data = {
|
||||
|
|
|
@ -4,8 +4,6 @@ var registerlogin = require("./registerlogin");
|
|||
|
||||
let controller = require("../controllers/controllers");
|
||||
|
||||
router.get("/verify-email", registerlogin.verifyemail);
|
||||
|
||||
router.get('/', (_req, res) => {
|
||||
res.render('pages/index');
|
||||
})
|
||||
|
@ -48,6 +46,16 @@ router.route('/login')
|
|||
});
|
||||
})
|
||||
|
||||
router.get('/verify-mail', (req, res) => {
|
||||
controller.verify_mail(req.params.token).then(data => {
|
||||
if (data == 200) {
|
||||
res.render("pages/register-verification-success");
|
||||
} else {
|
||||
res.render("pages/index");
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
router.get('/forgot-password', (_req, res) => {
|
||||
res.render('pages/forgot-password');
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue