JezK
Edit File: resetpassword.php
<?php $encodedToken = $_GET['token']; // User Id $token = base64_decode($encodedToken); ?> <!doctype html> <html lang="en"> <head> <title>Detailing Edition - Login</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="icon" type="image/png" href="./images/fav.png"> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@200;400;800&family=Mulish:wght@300;400;700&display=swap" rel="stylesheet"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.7/css/all.css"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> <link rel="stylesheet" href="./userstyles/userstyles.css"> <script src="js/validations.js"></script> </head> <body class="login-section"> <section> <div class="container-fluid"> <div class="row no-gutters"> <div class="col-md-6 d-none side-image p-0"> <img src="./images/logo.png" class="img-fluid" /> </div> <div class="col-md-6 form-container"> <div class="login-contents"> <h3 class="login-heading">New Password</h3> <div class="form-style"> <form id="resetForm"> <div class="form-group pb-2"> <label for="phone" class="form-label">New Password</label> <input type="password" class="form-control" id="newPassword" name="newPassword" placeholder="New Password"> <span class="toggle-icon1"><i class="fa fa-eye"></i></span> <div class="error passworderror"></div> <p class="error password_error"></p> </div> <div class="form-group pb-2"> <label for="password">Confirm Password</label> <!-- <input type="password" class="form-control" id="password" value="" placeholder="Enter password" > --> <input type="password" placeholder="Confirm Password" class="form-control" name="confrimPassword" id="confrimPassword"> <span class="toggle-icon"><i class="fa fa-eye"></i></span> <div class="error confrimPassworderror"></div> <p class="error password_error"></p> </div> <div class="error loginerror"></div> <div class="my-2 d-flex justify-content-center"> <button type="submit" class="de-btn-fill" onclick="return validateResetPassword();" name="login">SUBMIT</button> </div> </form> </div> </div> </div> </div> </div> </section> <?php include "./scripts.php"; include "./App/userObject.php"; ?> <script> let baseUrl = "<?php echo $baseUrl; ?>" let token = "<?php echo $token ?>"; $(document).ready(function() { $('.toggle-icon').click(function() { var input = $('#confrimPassword'); if (input.attr('type') === 'password') { input.attr('type', 'text'); $(this).find('i').removeClass('fa-eye').addClass('fa-eye-slash'); } else { input.attr('type', 'password'); $(this).find('i').removeClass('fa-eye-slash').addClass('fa-eye'); } }); $('.toggle-icon1').click(function() { var input = $('#newPassword'); if (input.attr('type') === 'password') { input.attr('type', 'text'); $(this).find('i').removeClass('fa-eye').addClass('fa-eye-slash'); } else { input.attr('type', 'password'); $(this).find('i').removeClass('fa-eye-slash').addClass('fa-eye'); } }); $('#resetForm').submit(function(event) { event.preventDefault(); let newPassword = $('#newPassword').val(); let confrimPassword = $('#confrimPassword').val(); $.ajax({ url: 'App/forgotpassword.php', method: 'POST', data: { reset: 'reset', newPassword: newPassword, confrimPassword: confrimPassword, token : token }, success: function(response) { if (response == 1 || response == 0) { // 1-new password, 0- old password location.replace('index.php'); } else { toastr.warning('Unable To Change Password') } } }); }); }); </script> </body> </html>