-
Notifications
You must be signed in to change notification settings - Fork 0
/
change-password.php
89 lines (76 loc) · 2.87 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
<?php
require "includes/login-header.php";
?>
<body>
<section class="container-fluid login-wrapper pt-3">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-6">
<div class="login-form">
<a href="javascript:history.back();" style="font-size: 1.3rem;"><i class="bi bi-arrow-left" style="margin-right: .5rem;"></i> </a>
<h2 class="pt-5 mt-5" style="font-size: 2.2rem; line-height: 1.3;">Change Password</h2>
<form id="status_form">
<div class="input-group mb-5">
<input type="password" class="form-control" name="password" id="password" placeholder="Enter Password">
</div>
<div class="input-group mb-5">
<input type="password" class="form-control" name="confirm_password" id="confirm_password" placeholder="Confirm Password">
</div>
<input type="hidden" id="user_id" value="<?= $id; ?>">
<div class="form-group">
<button type="submit" id="status_btn" class="form-control getStarted-btn">Continue</button>
</div>
</form>
</div>
</div>
</div>
</div>
</section>
<?php require "includes/login-footer.php"; ?>
<script>
$(document).on('click', '#status_btn', function(e){
e.preventDefault();
var password = $('#password').val();
var confirm_password = $('#confirm_password').val();
var user_id = $('#user_id').val();
if(password == "" || confirm_password == ""){
Swal.fire(
'Invalid',
'No field should be empty',
'error'
)
} else if(password.length < 6){
Swal.fire(
'Invalid',
'Password must be greater than 6',
'error'
)
} else if(password !== confirm_password){
Swal.fire(
'Invalid',
'Password does not match',
'error'
)
}
else {
$.ajax({
url: 'backend/change-password.php',
type: 'post',
data:
{
password: password,
confirm_password: confirm_password,
user_id:user_id
},
success: function(response){
Swal.fire(
'Success',
'Password Successfully changed',
'success'
)
}
});
$('#status_form')[0].reset();
}
});
</script>