-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathforget_password.php
71 lines (53 loc) · 2.01 KB
/
forget_password.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
require 'controllers/user.php';
$user = new User;
if (isset($_POST['recover_password'])) {
$email = $_POST["email"];
$code = uniqid(true);
if ($user->mailer($email,$code)) {
$url = "http://" . $_SERVER["HTTP_HOST"] . dirname($_SERVER["PHP_SELF"]) . "/resetPassword.php?code=$code";
$subject = 'Your Password Reset Link';
$body = "<h1>You requested a reset password link</h1>
<i>Click <a href='$url'> this link </a> to reset your password";
SendMail($email, $body, $subject, $url);
$_SESSION['mail-mgs'] = 'Reset Password link has been sent to your email';
header("location: login.php");
exit();
}
}
?>
<!DOCTYPE html>
<div lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href="https://fonts.googleapis.com/css?family=Poppins&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/newdashboard.css">
<link rel="stylesheet" href="css/form.css">
<!-- <link rel="stylesheet" href="css/main.css"> -->
<title>Document</title>
</head>
<body>
<!-- <div class="logo">
<img src="./images/Logo.png" alt="logo">
</div> -->
<div class="register_login-content" id="login-form">
<form action="" method="POST">
<h2 class="form-title">Recover Your Password</h2>
<div id="errorForResetPassword">
</div>
<div>
<label for="">Email</label>
<input type="email" name="email" id="email" class="text-input" required>
</div>
<div>
<button type="submit" class="btn btn-big" name="recover_password">Recover Password</button>
</div>
<p>Return back to <a href="login.php" class="text-danger">Login</a></p>
</form>
</div>
<script src="js/main.js"></script>
</body>
</div>