forked from Seitanas/kvm-vdi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
change_password.php
92 lines (86 loc) · 2.59 KB
/
change_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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/*
KVM-VDI
Tadas Ustinavičius
Vilnius University.
Center of Information Technology Development.
Vilnius,Lithuania.
2016-06-28
*/
include ('functions/config.php');
require_once('functions/functions.php');
if (!check_session()){
header ("Location: $serviceurl/?error=1");
exit;
}
slash_vars();
set_lang();
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<form method="POST" action="update_password.php" id="passwordForm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title"><?php echo _("Change password");?></h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-3">
</div>
<div class="col-md-6">
<input type="password" class="form-control" placeholder="<?php echo _("Enter password");?>" name="password1" id="password1">
</div>
</div>
<div class="row">
<div class="col-md-3">
</div>
<div class="col-md-6">
<input type="password" class="form-control" placeholder="<?php echo _("Repeat password");?>" name="password2" id="password2">
</div>
</div>
<div class="row">
<div class="col-md-3">
</div>
<div class="col-md-6">
<div class="alert alert-danger hide" id="alert">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo _("Close");?></button>
<button type="submit" class="btn btn-primary" id="submit"><?php echo _("Save changes");?></button>
</div>
</div>
</form>
</body>
<script>
jQuery(function(){
$("#submit").click(function(){
$(".error").hide();
var hasError = false;
var passwordVal = $("#password1").val();
var checkVal = $("#password2").val();
if (passwordVal == '') {
$('#alert').removeClass('hide');
$('#alert').html(<?php echo _("'<strong>Error!</strong> Empty password.'");?>);
hasError = true;
} else if (checkVal == '') {
$('#alert').removeClass('hide');
$('#alert').html(<?php echo _("'<strong>Error!</strong> Empty password.'");?>);
hasError = true;
} else if (passwordVal != checkVal ) {
$('#alert').removeClass('hide');
$('#alert').html(<?php echo _("'<strong>Error!</strong> Passwords do not match.'");?>);
hasError = true;
}
if(hasError == true) {return false;}
});
});
</script>
</html>