forked from alexlittle/mQuiz
/
reset.php
52 lines (45 loc) · 1.29 KB
/
reset.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
<?php
include_once("config.php");
global $PAGE,$MSG,$API;
$PAGE = "reset";
$submit = optional_param("submit","",PARAM_TEXT);
$email = optional_param("email","",PARAM_TEXT);
include_once("./includes/header.php");
echo "<h1>".getstring("reset.title")."</h1>";
if ($submit != ""){
// check email entered
if($email == ""){
array_push($MSG, "Please enter your email address");
} else if(!$API->checkUserEmailExists($email)){
array_push($MSG, "Email address not found.");
}
if(empty($MSG) && $API->resetPassword($email)){
printf("A new password has been emailed to you.");
include_once("./includes/footer.php");
die;
}
}
if(!empty($MSG)){
echo "<div class='warning'><ul>";
foreach ($MSG as $err){
echo "<li>".$err."</li>";
}
echo "</ul></div>";
}
echo "<p>".getstring("reset.text")."</h1>";
?>
<form method="post" action="">
<div class="formblock">
<div class="formlabel"><?php echo getstring('register.email'); ?></div>
<div class="formfield"><input type="text" name="email" value="<?php echo $email; ?>"></input></div>
</div>
<div class="formblock">
<div class="formlabel"> </div>
<div class="formfield">
<input type="submit" name="submit" value="<?php echo getstring("reset.submit.button"); ?>"></input>
</div>
</div>
</form>
<?php
include_once("./includes/footer.php");
?>