Fix file paths and add password reset functionality

This commit is contained in:
newtbot
2024-01-31 03:17:24 +08:00
parent 12597ad774
commit fea986a841
12 changed files with 169 additions and 39 deletions

View File

@ -81,7 +81,7 @@
</p>
</div>
</footer>
<script src="js/search.js"></script>
<script src="/js/search.js"></script>
</body>

View File

@ -7,6 +7,8 @@
<div class="error-contents">
<h3>Please check your email for the reset password link</h3>
</div>
<br>
<br>
<br>
<a>Dont have an account?</a> <a href="/login">Sign Up</a>

View File

@ -6,14 +6,14 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" type="images/logo.ico" href="images/logo.ico" />
<link rel="shortcut icon" type="images/logo.ico" href="/images/logo.ico" />
<!-- Bootstrap core CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<!-- Custom styles for this template -->
<link rel="stylesheet" href="css/sp.css" />
<link rel="stylesheet" href="/css/sp.css" />
<!-- jQuery library -->
@ -30,7 +30,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.2.0/socket.io.min.js"></script>
<!-- jquery app.js -->
<script src="js/app.js"></script>
<script src="/js/app.js"></script>
</head>
@ -66,7 +66,7 @@
<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-light top-nav fixed-top">
<div class="container">
<a class="navbar-brand" href="/">
<img src="images/logo.png" alt="logo" />
<img src="/images/logo.png" alt="logo" />
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive"
aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">

View File

@ -5,9 +5,12 @@
<section class="wrapper">
<div class="form">
<header>Reset Password</header>
<form action="auth/resetPassword" >
<input type="password" name="password" placeholder="password" required>
<input type="cpassword" name="cpassword" placeholder="cpassword" required>
<div class="card-header shadow actionMessage" style="display:none"></div>
<!-- <form action="auth/resetpassword/<%= token.token%>" method="post" onsubmit="formAJAX(this)"> -->
<form action="auth/resetpassword/<%= token%>" method="post" onsubmit="formAJAX(this)" evalAJAX="app.auth.logInRedirect();">
<input type="password" id="password" name="password" placeholder="Password" required />
<input type="password" id="confirmPassword" name="confirmPassword" placeholder="Confirm Password"
required />
<input type="submit" value="Reset Password" />
</form>
<br>
@ -15,12 +18,29 @@
</div>
</section>
<table class="footer">
<tr>
<td>
<p>&copy; 2024 EcoSaver</p>
</td>
</tr>
</table>
</body>
<script>
//both password fields must match
var password = document.getElementById("password");
var confirm_password = document.getElementById("confirmPassword");
function validatePassword() {
var passwordValue = password.value;
// Strong password regex pattern
var strongPasswordPattern = /^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,}$/;
if (passwordValue != confirm_password.value) {
confirm_password.setCustomValidity("Passwords Don't Match");
} else if (!strongPasswordPattern.test(passwordValue)) {
confirm_password.setCustomValidity("Password must be at least 8 characters long and include at least one letter, one number, and one special character.");
} else {
confirm_password.setCustomValidity('');
}
}
password.onchange = validatePassword;
confirm_password.onkeyup = validatePassword;
</script>

View File

@ -4,7 +4,6 @@
//app.auth.redirectIfLoggedIn();
</script>
<body>
<section class="wrapper">
<div class="form signup iot-card">
<!--<div class="form signup card" -->
@ -67,7 +66,7 @@
confirm_password.onkeyup = validatePassword;
const wrapper = document.querySelector(".wrapper"),
signupHeader = document.querySelector(".signup header"),
loginHeader = document.querySelector(".login header");

View File

@ -9,7 +9,7 @@
<meta http-equiv="cleartype" content="on" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="shortcut icon" type="images/logo.ico" href="images/logo.ico" />
<link rel="shortcut icon" type="images/logo.ico" href="/images/logo.ico" />
<!-- Bootstrap core CSS -->
@ -17,8 +17,8 @@
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous" />
<!-- Custom styles for this template -->
<link href="css/all.css" rel="stylesheet" />
<link href="css/style.css" rel="stylesheet" />
<link href="/css/all.css" rel="stylesheet" />
<link href="/css/style.css" rel="stylesheet" />
<!-- weird api page cdn -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
@ -46,10 +46,10 @@
<!-- <script src="https://cdn.jsdelivr.net/npm/jquery.fancytable/dist/fancyTable.min.js"></script> -->
<!-- jq-repeat -->
<script src="js/jq-repeat.js"></script>
<script src="/js/jq-repeat.js"></script>
<!-- jquery public app.js -->
<script src="js/app.js"></script>
<script src="/js/app.js"></script>
</head>
<!-- javascript function to check if user is auth -->
<script>
@ -80,7 +80,7 @@
<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-light top-nav fixed-top">
<div class="container">
<a class="navbar-brand" href="/">
<img src="images/logo.png" alt="logo" />
<img src="/images/logo.png" alt="logo" />
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive"
aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">