-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdatePassword.php
71 lines (64 loc) · 3.11 KB
/
updatePassword.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
include 'stylesheets.php';
include 'nav.php';;
if(!$_SESSION['logged_in']){
header('Location:index.php');
}
?>
<html>
<head>
<link rel="stylesheet" href="manag.css?v=<?=time();?>">
<script src = "JS/updatePasswordValidation.js"></script>
</head>
<body>
<div id = "container">
<div id = "headerBar">
<h2 id = "headerTitle">Update Password</h2>
</div>
<form id ="submit" method = "post" action = "updatePasswordHandler.php">
<div id = "inputContainer">
<label for = "currentPassword">Current Password</label>
<div id = "inputError">
<input type = "password" name = "currentPassword" id = "currentPassword" class = "input"></input>
<span class = "error"><?php if(isset($_SESSION['errors']['currentPassword'])){echo $_SESSION['errors']['currentPassword'];}?></span>
</div>
</div>
<div id = "inputContainer">
<label for = "newPassword1">New Password</label>
<div id = "inputError">
<input type = "password" name = "newPassword1" id = "newPassword1" class = "input"></input>
<span class = "error"><?php if(isset($_SESSION['errors']['newPassword1'])){echo $_SESSION['errors']['newPassword1'];}?></span>
</div>
</div>
<div id = "inputContainer">
<label for = "newPassword2">Confirm Password</label>
<div id = "inputError">
<input type = "password" name = "newPassword2" id = "newPassword2" class = "input"></input>
<span class = "error"><?php if(isset($_SESSION['errors']['newPassword2'])){echo $_SESSION['errors']['newPassword2'];}?></span>
</div>
</div>
<?php if(isset($_SESSION['additionalErrors'])){
echo '<div id = "additionalErrors">
<div id = "error_box">
<span class="error_symbol"><i class="fas fa-exclamation-triangle"></i></span>
<span class = "middle">'.$_SESSION['additionalErrors'].'</span>
<span class = "right"><i class="fas fa-times-circle"></i></span>
</div>
</div>';
}
if(isset($_SESSION['succesfulForm']) && !$_SESSION['succesfulForm']){
echo '<h4 class = "error">There were errors in your form the password was not updated</h4>';
}
else if($_SESSION['succesfulForm']){
echo '<h4 class = "good">Password Updated</h4>';
}
$_SESSION['additionalErrors'] = NULL;
$_SESSION['errors'] = NULL;
$_SESSION['succesfulForm'] = NULL;
?>
<button class = "button" type = "submit">Update Password</button>
</div>
</form>
</div>
</body>
</html>