LRR/UpdatePassword.php

55 lines
1.7 KiB
PHP

<?php
include 'Header.php';
?>
<?php
//Related RESET PASSWORD
// if the user has already logged in, then clicking the LRRS icon should not display the login page (i.e., index.php).
if (isset($_SESSION["user_fullname"])) {
echo '<div class="container alert alert-info"> You\'ve already logged in.</div>';
exit();
}
?>
<br><br><br>
<div class="container">
<div class="row">
<div class="col-md-5"></div>
<div class="col-md-5">
<?PHP
// Check if the token is valid and not expired
if (isset($_GET['token'])) {
$token = $_GET['token'];
?>
<form method="post" action="Script.php" id="update_password_form">
<legend>Password Reset</legend>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="hidden" name="update_password_form" value="true" />
Password <label class="form-text">must include uppercase and lowercase letters, digits and special characters</label>
<input type="password" class="form-control" name="password" placeholder="Enter password" required="required" id="password1" /> <br>
Confirm Password
<input type="password" class="form-control" name="confirmpassword" placeholder="Confirm password" required="required" id="password2" /> <br>
<br>
<button type="submit" class="btn btn-primary" id="update_password_btn">Reset</button>
<?php
}
error_reporting(E_ALL);
if (isset($_SESSION['info_update_password'])) {
echo '<hr><div class="alert alert-danger" role="alert"> ' . $_SESSION['info_update_password'] . '</div>';
$_SESSION['info_update_password'] = null;
}
?>
</form>
</div>
</div>
</div>