forked from svenMolhuijsen/EenmaalAndermaal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
passrecovery.php
77 lines (71 loc) · 2.02 KB
/
passrecovery.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
72
73
74
75
76
77
<?php
$pagename = "Password recovery";
include("php/core.php");
include("php/layout/header.php");
include("php/layout/breadcrumbs.php");
//Scherm de pagina af
if (!isset($_GET['t'])) {
include("php/layout/geentoegang.html");
} else {
$vervalDatum = executeQuery("SELECT expire_Date FROM password_recovery where token = ?",[$_GET['t']]);
if ($vervalDatum['data'][0]["expire_Date"] > date("Y-m-d h:i:s")) {
?>
<main>
<div class="columns row text-center" id="content">
<h2>U kunt hier uw wachtwoord veranderen</h2>
<form id="passResetForm">
<div class="input-group">
<!-- Nieuwe wachtwoord -->
<input type="password" class="input-group-field" placeholder="New password" id="NEWPassword" pattern="^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).*$" required>
<div class="input-group-button">
<input type="submit" class="button" id="veranderWachtwoord">
</div>
</div>
</form>
</div>
</main>
<?php
} else {
include("php/layout/geentoegang.html");
}
}
include("php/layout/footer.html");
?>
<script>
$(document).ready(function() {
var errorCSS = {
"margin-bottom": "0",
"bottom": "0",
"right": "0"
};
$('#passResetForm').validate({
submitHandler: function () {
submitReset()
},
errorPlacement: function(error, element) {
error.appendTo(element.parent().parent());
error.addClass("hide-for-small show-for-large");
error.css(errorCSS);
}
})
});
//Veranderen van wachtwoord
function submitReset() {
var data = {
nieuwWachtwoord: $('#NEWPassword').val(),
token: "<?php echo($_GET['t'])?>"
};
$.ajax({
type: 'POST',
url: 'php/api.php?action=veranderWachtwoord',
data: data,
dateType: 'json',
complete: function () {
$('#content').empty();
$('#content').append("<h4>Wachtwoord is gewijzigd!</h4>");
}
});
}
</script>
</body>
</html>