mirror of
https://github.com/PretendoNetwork/website.git
synced 2026-09-10 09:56:48 -05:00
added forget password frontend
This commit is contained in:
@@ -40,6 +40,24 @@ function login() {
|
||||
}
|
||||
}
|
||||
|
||||
function passwordForgot() {
|
||||
var xhr = postAjax('/api/v1/passwordforgot', {
|
||||
email: document.getElementById('email_input').value
|
||||
});
|
||||
xhr.onload = function () {
|
||||
if (xhr.responseText.charAt(0) !== "{") {
|
||||
return showErrorPopup('Whoops, something went wrong. Try again later.');
|
||||
}
|
||||
response = JSON.parse(xhr.responseText);
|
||||
if (response.success === true) {
|
||||
document.getElementById('email_input').value = '';
|
||||
return showSuccessPopup('An email has been sent to your email address.');
|
||||
} else if (response.errors) {
|
||||
showErrorPopup(response.errors);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function passwordReset() {
|
||||
var xhr = postAjax('/api/v1/passwordreset', {
|
||||
password: document.getElementById('password_input').value,
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
"email_text": "Username or Email",
|
||||
"password_text": "Password",
|
||||
"button_text": "Sign In",
|
||||
"forgotpass_introduction": "Forgot password?",
|
||||
"forgotpass_text": "Click here to reset it.",
|
||||
"link_introduction": "Don't have an account yet?",
|
||||
"link_text": "Click here to register."
|
||||
}
|
||||
@@ -77,6 +79,14 @@
|
||||
"button_text": "Reset password"
|
||||
}
|
||||
},
|
||||
"forgot": {
|
||||
"card": {
|
||||
"caption": "Did you forget something?",
|
||||
"title": "Forgot password",
|
||||
"email_text": "Email address",
|
||||
"button_text": "Send email"
|
||||
}
|
||||
},
|
||||
"about": {
|
||||
"caption": "What is this?",
|
||||
"title": "About",
|
||||
|
||||
@@ -41,6 +41,17 @@ router.get('/pnid/login', (request, response) => {
|
||||
locale: utilHelper.getLocale('US', 'en')
|
||||
});
|
||||
});
|
||||
// renders password forget
|
||||
router.get('/pnid/forgotpassword', (request, response) => {
|
||||
return response.render('forgot', {
|
||||
title: 'Pretendo | Forgot password',
|
||||
description: 'On the Pretendo Network ID Dashboard you can manage your personal information and make new virtual consoles to use for login on your home console.',
|
||||
url: request.protocol + '://' + request.get('host') + request.originalUrl,
|
||||
baseurl: request.protocol + '://' + request.get('host'),
|
||||
locale: utilHelper.getLocale('US', 'en'),
|
||||
user: utilHelper.templateReadyUser(request)
|
||||
});
|
||||
});
|
||||
// renders password reset page
|
||||
router.get('/pnid/passwordreset', (request, response) => {
|
||||
return response.render('password', {
|
||||
|
||||
28
views/forgot.hbs
Normal file
28
views/forgot.hbs
Normal file
@@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
{{> metatags }}
|
||||
<title>{{ title }}</title>
|
||||
<!-- css files -->
|
||||
<link rel="stylesheet" href="/assets/css/pretendo-common.css">
|
||||
<!-- page specific -->
|
||||
<link rel="stylesheet" href="/assets/css/pretendo-auth.css">
|
||||
<script src="/assets/js/api.js" defer></script>
|
||||
</head>
|
||||
<body class="flex center">
|
||||
<div class="card">
|
||||
<h2 class="head">{{ locale.nav.brand }}</h2>
|
||||
<div class="content">
|
||||
<p class="txt-highlight">{{ locale.forgot.card.caption }}</p>
|
||||
<h1 class="txt-title small">{{ locale.forgot.card.title }}</h1>
|
||||
<div id="errorBox" class="error hide"></div>
|
||||
<form method="POST">
|
||||
<label for="email_input">{{ locale.forgot.card.email_text}}</label>
|
||||
<input type="text" class="hasLabel" id="email_input" name="email_input">
|
||||
</form>
|
||||
<button class="btn btnMargin" onclick="passwordForgot();">{{ locale.forgot.card.button_text }}</button>
|
||||
</div>
|
||||
</div>
|
||||
{{> footer-default }}
|
||||
</body>
|
||||
</html>
|
||||
@@ -21,6 +21,7 @@
|
||||
<input type="text" class="hasLabel" id="email_input" name="email">
|
||||
<label for="email">{{ locale.login.card.password_text }}</label>
|
||||
<input type="password" class="hasLabel" id="password_input" name="password">
|
||||
<p class="lowText">{{ locale.login.card.forgotpass_introduction }} <a href="/pnid/forgotpassword">{{ locale.login.card.forgotpass_text }}</a></p>
|
||||
</form>
|
||||
<button class="btn btnMargin" onclick="login();">{{ locale.login.card.button_text }}</button>
|
||||
<p class="lowText">{{ locale.login.card.link_introduction }} <a href="/pnid/register">{{ locale.login.card.link_text }}</a></p>
|
||||
|
||||
Reference in New Issue
Block a user