php-gallery/password-reset.php

54 lines
1.5 KiB
PHP
Raw Normal View History

2022-09-21 13:37:45 +00:00
<?php require_once __DIR__."/app/required.php"; ?>
2022-09-21 13:02:38 +00:00
2022-07-26 13:27:27 +00:00
<!DOCTYPE html>
<html>
2022-08-15 10:56:05 +00:00
2022-07-26 13:27:27 +00:00
<head>
2022-09-21 13:37:45 +00:00
<?php require_once __DIR__."/assets/ui/header.php"; ?>
2022-07-26 13:27:27 +00:00
</head>
2022-08-15 10:56:05 +00:00
2022-07-26 13:27:27 +00:00
<body>
2022-08-15 10:56:05 +00:00
<?php
2022-09-21 13:37:45 +00:00
require_once __DIR__."/assets/ui/nav.php";
2022-07-26 13:27:27 +00:00
2022-09-21 13:02:38 +00:00
use App\Account;
2022-09-12 14:15:16 +00:00
2022-09-21 13:02:38 +00:00
$user_info = new Account();
2022-09-12 14:15:16 +00:00
2022-09-21 13:02:38 +00:00
// Check if the user is logged in, otherwise redirect to login page
if ($user_info->is_loggedin() != true) {
header("location: account.php");
exit;
}
2022-08-15 10:56:05 +00:00
?>
2022-07-26 13:27:27 +00:00
2022-08-15 10:56:05 +00:00
<div class="password-reset-root">
<h2>Reset Password</h2>
<p>After reset, you will be kicked out to login again</p>
<br>
<form id="passwordForm" method="POST" enctype="multipart/form-data">
<input id="newPassword" class="btn btn-neutral" type="password" name="new_password" placeholder="New Password">
2022-09-17 10:28:29 +00:00
<input id="confirmPassword" class="btn btn-neutral" type="password" name="confirm_password" placeholder="Confirm Password">
2022-08-15 10:56:05 +00:00
<br>
2022-09-07 09:41:18 +00:00
<button id="passwordSubmit" class="btn btn-bad" type="submit" name="reset"><img class="svg" src="assets/icons/sign-in.svg">Reset</button>
2022-08-15 10:56:05 +00:00
</form>
</div>
2022-07-26 13:27:27 +00:00
2022-08-15 10:56:05 +00:00
<script>
$("#passwordForm").submit(function(event) {
event.preventDefault();
2022-09-19 19:21:57 +00:00
var new_password = $("#newPassword").val();
2022-09-17 10:28:29 +00:00
var confirm_password = $("#confirmPassword").val();
2022-08-15 10:56:05 +00:00
var submit = $("#passwordSubmit").val();
2022-09-20 10:12:32 +00:00
$("#sniffle").load("app/account/account.php", {
2022-09-19 19:21:57 +00:00
new_password: new_password,
2022-08-15 10:56:05 +00:00
confirm_password: confirm_password,
2022-09-20 10:12:32 +00:00
password_reset_submit: submit
2022-08-15 10:56:05 +00:00
});
});
</script>
2022-08-13 11:04:24 +00:00
2022-09-21 13:37:45 +00:00
<?php require_once __DIR__."/assets/ui/footer.php"; ?>
2022-07-26 13:27:27 +00:00
</body>
2022-08-15 10:56:05 +00:00
</html>