forked from bdobry/hackathon2016
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.php
More file actions
96 lines (78 loc) · 3.04 KB
/
Copy pathprofile.php
File metadata and controls
96 lines (78 loc) · 3.04 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
session_start();
if(!isset($_SESSION["isAuthenticated"]) || !$_SESSION["isAuthenticated"]){
header("location: /hackathon2016/index.php");
exit;
}
?>
<?php
echo file_get_contents("head.php");
?>
<?php
echo file_get_contents("header.php");
?>
<div class="container">
<!-- Jumbotron Header -->
<header class="jumbotron fp-jt">
<h1>Edit profile</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsa, ipsam, eligendi, in quo sunt possimus non incidunt odit vero aliquid similique quaerat nam nobis illo aspernatur vitae fugiat numquam repellat.</p>
</header>
<hr>
<div class="col-lg-6">
<form action="editProfile.php" method="post" name="editProfileForm" id="editProfileForm">
<div class="form-group">
<label for="user">Change username</label>
<input id="user" type="text" class="form-control" name="user" placeholder="<?php echo $_SESSION["userName"] ?>">
</div>
<div class="form-group">
<label for="email">Change Email</label>
<input type="email" class="form-control" id="email" name="email" placeholder="<?php echo $_SESSION["email"] ?>">
</div>
<div class="form-group">
<label for="oldPass">Current Password</label>
<input id="oldPass" type="password" class="form-control" name="oldPass" placeholder="Current Password">
</div>
<div class="form-group">
<label for="newPass1">New Password</label>
<input id="newPass1" type="password" class="form-control" name="newPass1" placeholder="New Password">
</div>
<div class="form-group">
<label for="newPass2">Repeat New Password</label>
<input id="newPass2" type="password" class="form-control" name="newPass2" placeholder="Repeat New Password">
</div>
<div>
<p class="alert alert-danger" name="passError" hidden>The New Password field needs to match the Repeat New Password field</p>
</div>
<div class="form-group">
<div onclick="submit()" class="btn btn-success login login-submit">Save changes</div>
</div>
</form>
</div>
</div>
<!-- Footer -->
<?php
echo file_get_contents("pagefooter.php");
?>
<?php
echo file_get_contents("footer.php");
?>
<script type="application/javascript">
var submit = function () {
var rdyToSubmit = true;
var oldPass = document.getElementsByName("oldPass");
var newPass1 = document.getElementsByName("newPass1");
var newPass2 = document.getElementsByName("newPass2");
var errorMessage = document.getElementsByName("passError");
if (newPass1[0].value == newPass2[0].value) {
//todo check old password on server
}
else{
console.log(errorMessage);
errorMessage[0].removeAttribute("hidden");
rdyToSubmit = false;
}
if(rdyToSubmit){
document.getElementsByName("editProfileForm")[0].submit();
}
};
</script>