mirror of
https://gitlab.com/nekoya/web.git
synced 2024-11-14 02:16:19 +01:00
Update forgot password
This commit is contained in:
parent
9831193fe6
commit
439a9e289d
7 changed files with 56 additions and 23 deletions
|
@ -161,18 +161,51 @@ router.route("/checkout")
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get("/forgot-password", (_req, res) => {
|
|
||||||
res.render("pages/forgot-password");
|
router.route("/reset-password")
|
||||||
});
|
.get((req, res) => {
|
||||||
|
if (!req.query.token) {
|
||||||
|
res.redirect("/");
|
||||||
|
} else {
|
||||||
|
res.render("pages/reset-password", {
|
||||||
|
token: req.query.token
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.post((req, res) => {
|
||||||
|
controller.reset_password(req.query.token, req.body.password).then((data) => {
|
||||||
|
if (data[0] == 200) {
|
||||||
|
res.render("pages/register-verification-completed");
|
||||||
|
} else {
|
||||||
|
res.redirect("/");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
router.route("/forgot-password")
|
||||||
|
.get((req, res) => {
|
||||||
|
auth.session_converter(req.cookies.session_token).then((key) => {
|
||||||
|
if (key != null) {
|
||||||
|
res.redirect("/");
|
||||||
|
} else {
|
||||||
|
res.render("pages/forgot-password");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.post((req, res) => {
|
||||||
|
controller.request_reset_password(req.body.email).then((data) => {
|
||||||
|
if (data[0] == 200) {
|
||||||
|
res.render("pages/register-verification-sent");
|
||||||
|
} else {
|
||||||
|
res.redirect("/forgot-password");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
router.get("/otp", (_req, res) => {
|
router.get("/otp", (_req, res) => {
|
||||||
res.render("pages/otp");
|
res.render("pages/otp");
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get("/change-password", (_req, res) => {
|
|
||||||
res.render("pages/change-password");
|
|
||||||
});
|
|
||||||
|
|
||||||
router.get("/products", (req, res) => {
|
router.get("/products", (req, res) => {
|
||||||
auth.session_converter(req.cookies.session_token).then((key) => {
|
auth.session_converter(req.cookies.session_token).then((key) => {
|
||||||
if (key != null) {
|
if (key != null) {
|
||||||
|
|
|
@ -38,8 +38,8 @@
|
||||||
<script type="text/javascript" src="/js/payment.js"></script>
|
<script type="text/javascript" src="/js/payment.js"></script>
|
||||||
<% } else if(state == "login") { %>
|
<% } else if(state == "login") { %>
|
||||||
<script type="text/javascript" src="/js/login.js"></script>
|
<script type="text/javascript" src="/js/login.js"></script>
|
||||||
<% } else if(state == "change-password") { %>
|
<% } else if(state == "reset-password") { %>
|
||||||
<script type="text/javascript" src="/js/change-password.js"></script>
|
<script type="text/javascript" src="/js/reset-password.js"></script>
|
||||||
<% } else if(state == "register") { %>
|
<% } else if(state == "register") { %>
|
||||||
<script type="text/javascript" src="/js/register.js"></script>
|
<script type="text/javascript" src="/js/register.js"></script>
|
||||||
<% } else if(state == "otp") { %>
|
<% } else if(state == "otp") { %>
|
||||||
|
|
|
@ -41,8 +41,8 @@
|
||||||
<link href="/css/register-verification-sent.css" rel="stylesheet">
|
<link href="/css/register-verification-sent.css" rel="stylesheet">
|
||||||
<% } else if(state == "forgot-password") { %>
|
<% } else if(state == "forgot-password") { %>
|
||||||
<link href="/css/forgot-password.css" rel="stylesheet">
|
<link href="/css/forgot-password.css" rel="stylesheet">
|
||||||
<% } else if(state == "change-password") { %>
|
<% } else if(state == "reset-password") { %>
|
||||||
<link href="/css/change-password.css" rel="stylesheet">
|
<link href="/css/reset-password.css" rel="stylesheet">
|
||||||
<% } else if(state == "otp") { %>
|
<% } else if(state == "otp") { %>
|
||||||
<link href="/css/otp.css" rel="stylesheet">
|
<link href="/css/otp.css" rel="stylesheet">
|
||||||
<% } else if(state == "faq") { %>
|
<% } else if(state == "faq") { %>
|
||||||
|
|
|
@ -17,15 +17,15 @@
|
||||||
<a>Enter your email to receive a link to reset your password.</a>
|
<a>Enter your email to receive a link to reset your password.</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form class="px-4 py-3">
|
<form class="px-4 py-3" action="forgot-password" method="POST">
|
||||||
<div class="form-group" style="text-align: left;">
|
<div class="form-group" style="text-align: left;">
|
||||||
<a data-feather="mail" href="" style="font-size: 40px;"></a>
|
<a data-feather="mail" href="" style="font-size: 40px;"></a>
|
||||||
<label for="exampleDropdownFormEmail1">Email</label>
|
<label for="exampleDropdownFormEmail1">Email</label>
|
||||||
<input class="form-control input-sm text-center" id="exampleDropdownFormEmail1"
|
<input class="form-control input-sm text-center"
|
||||||
placeholder="Email address" type="email">
|
placeholder="Email address" type="email" id="email" name="email">
|
||||||
</div>
|
</div>
|
||||||
<a href="otp"><input class="btn btn-resetpassword btn-primary" style="width: 100%;"
|
<input class="btn btn-resetpassword btn-primary" style="width: 100%;"
|
||||||
type="button" value="Reset Password"></a>
|
type="submit" value="Reset Password">
|
||||||
<br><br>
|
<br><br>
|
||||||
<div class="hoverforgot-1 text-center">
|
<div class="hoverforgot-1 text-center">
|
||||||
<a href="login">Or Return to Login</a>
|
<a href="login">Or Return to Login</a>
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<%- include('../layouts/header.ejs', {title: 'Change Password', state: 'change-password'}); %>
|
<%- include('../layouts/header.ejs', {title: 'Reset Password', state: 'reset-password'}); %>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<%- include('../layouts/navbar.ejs', {types: 'v2', title: 'Change Password'}); %>
|
<%- include('../layouts/navbar.ejs', {types: 'v2', title: 'Reset Password'}); %>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="card text-white col-md-8 col-lg-6 col-xl-5">
|
<div class="card text-white col-md-8 col-lg-6 col-xl-5">
|
||||||
<h1 class="card-header text-white">Change Password</h1>
|
<h1 class="card-header text-white">Reset Password</h1>
|
||||||
<lottie-player autoplay background="transparent" class="icon" loop speed="5" style="height: 300px;"
|
<lottie-player autoplay background="transparent" class="icon" loop speed="5" style="height: 300px;"
|
||||||
src="https://assets9.lottiefiles.com/packages/lf20_rlhnbbev.json"></lottie-player>
|
src="https://assets9.lottiefiles.com/packages/lf20_rlhnbbev.json"></lottie-player>
|
||||||
<div class="py-3 text" style="padding: 0% 5%; text-align: center;">
|
<div class="py-3 text" style="padding: 0% 5%; text-align: center;">
|
||||||
<a>Please Enter a new password to change the current one.</a>
|
<a>Please Enter a new password to change the current one.</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form class="px-4 py-3">
|
<form class="px-4 py-3" action="reset-password?token=<%= token %>" method="POST">
|
||||||
<div class="form-group" style="text-align: left;">
|
<div class="form-group" style="text-align: left;">
|
||||||
<a data-feather="key" href="" style="font-size: 40px;"></a>
|
<a data-feather="key" href="" style="font-size: 40px;"></a>
|
||||||
<label for="password">New Password</label>
|
<label for="password">New Password</label>
|
||||||
|
@ -44,8 +44,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a href="login"><input class="btn btn-resetpassword btn-primary" style="width: 100%;"
|
<a><input class="btn btn-resetpassword btn-primary" style="width: 100%;"
|
||||||
type="button" value="Reset Password"></a>
|
type="submit" value="Reset Password"></a>
|
||||||
<br><br>
|
<br><br>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%- include('../layouts/footer.ejs', {state: 'change-password'}); %>
|
<%- include('../layouts/footer.ejs', {state: 'reset-password'}); %>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
Loading…
Reference in a new issue