forked from NightingaleNath/leave_portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreset_password.php
190 lines (173 loc) · 8.82 KB
/
reset_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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<!DOCTYPE html>
<html lang="en">
<head>
<title>Leave Management System </title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="#">
<meta name="keywords" content="Admin , Responsive, Landing, Bootstrap, App, Template, Mobile, iOS, Android, apple, creative app">
<meta name="author" content="#">
<!-- Favicon icon -->
<link rel="icon" href=".\files\assets\images\favicon.ico" type="image/x-icon">
<!-- Google font--><link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600,800" rel="stylesheet">
<!-- Required Fremwork -->
<link rel="stylesheet" type="text/css" href=".\files\bower_components\bootstrap\css\bootstrap.min.css">
<!-- themify-icons line icon -->
<link rel="stylesheet" type="text/css" href=".\files\assets\icon\themify-icons\themify-icons.css">
<link rel="stylesheet" type="text/css" href=".\files\assets\icon\feather\css\feather.css">
<!-- ico font -->
<link rel="stylesheet" type="text/css" href=".\files\assets\icon\icofont\css\icofont.css">
<!-- Style.css -->
<link rel="stylesheet" type="text/css" href=".\files\assets\css\style.css">
</head>
<?php include('includes/config.php'); ?>
<?php include('includes/session.php');?>
<body class="fix-menu">
<!-- Pre-loader start -->
<?php include('includes/loader.php')?>
<!-- Pre-loader end -->
<section class="login-block">
<!-- Container-fluid starts -->
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<!-- Login card start -->
<form method="POST" class="md-float-material form-material">
<div class="auth-box card">
<div class="card-block">
<div class="row">
<div class="col-md-12">
<h3 class="text-center"><i class="feather icon-lock text-primary f-60 p-t-15 p-b-20 d-block"></i></h3>
</div>
</div>
<div class="form-group form-primary">
<input type="password" id="new_password" name="new_password" class="form-control password" required="" placeholder="New Password">
<span class="form-bar"></span>
</div>
<div class="form-group form-primary">
<input type="password" id="confirm_password" name="confirm_password" class="form-control password" required="" placeholder="Confirm Password">
<span class="form-bar"></span>
</div>
<div class="row">
<div class="col-md-12">
<button id="reset-password" type="submit" class="btn btn-primary btn-md btn-block waves-effect text-center m-b-20"><i class="icofont icofont-lock"></i> Reset Password </button>
</div>
</div>
<p class="text-inverse text-right">Back to <a href="index.php">Login</a></p>
</div>
</div>
</form>
<!-- Login card end -->
</div>
<!-- end of col-sm-12 -->
</div>
<!-- end of row -->
</div>
<!-- end of container-fluid -->
</section>
<!-- Required Jquery -->
<script type="text/javascript" src=".\files\bower_components\jquery\js\jquery.min.js"></script>
<script type="text/javascript" src=".\files\bower_components\jquery-ui\js\jquery-ui.min.js"></script>
<script type="text/javascript" src=".\files\bower_components\popper.js\js\popper.min.js"></script>
<script type="text/javascript" src=".\files\bower_components\bootstrap\js\bootstrap.min.js"></script>
<!-- jquery slimscroll js -->
<script type="text/javascript" src=".\files\bower_components\jquery-slimscroll\js\jquery.slimscroll.js"></script>
<!-- modernizr js -->
<script type="text/javascript" src=".\files\bower_components\modernizr\js\modernizr.js"></script>
<script type="text/javascript" src=".\files\bower_components\modernizr\js\css-scrollbars.js"></script>
<!-- i18next.min.js -->
<script type="text/javascript" src=".\files\bower_components\i18next\js\i18next.min.js"></script>
<script type="text/javascript" src=".\files\bower_components\i18next-xhr-backend\js\i18nextXHRBackend.min.js"></script>
<script type="text/javascript" src=".\files\bower_components\i18next-browser-languagedetector\js\i18nextBrowserLanguageDetector.min.js"></script>
<script type="text/javascript" src=".\files\bower_components\jquery-i18next\js\jquery-i18next.min.js"></script>
<!--Color Script Common-->
<script type="text/javascript" src=".\files\assets\js\common-pages.js"></script>
<script src="https://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.7.5/dist/sweetalert2.all.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.7.5/dist/sweetalert2.min.css"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="" src="https://www.googletagmanager.com/gtag/js?id=UA-23581568-13"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-23581568-13');
</script>
<script type="text/javascript">
$('#reset-password').click(function(event){
event.preventDefault(); // prevent the default form submission
var newPassword = $('#new_password').val();
var confirmPassword = $('#confirm_password').val();
if (newPassword.trim() === '' || confirmPassword.trim() === '') {
Swal.fire({
icon: 'warning',
text: 'Please fill in all fields',
confirmButtonColor: '#ffc107',
confirmButtonText: 'OK'
});
return;
}
if (newPassword !== confirmPassword) {
Swal.fire({
icon: 'warning',
text: 'Passwords do not match',
confirmButtonColor: '#ffc107',
confirmButtonText: 'OK'
});
return;
}
var data = {
new_password: newPassword,
confirm_password: confirmPassword,
action: "reset_password"
};
$.ajax({
url: 'reset_pass_function.php',
type: 'post',
data: data,
dataType: 'json',
success: function(response){
console.log(response.message);
console.log("response user_type: " + response.role);
if (response.status == 'success') {
Swal.fire({
icon: 'success',
title: response.message,
confirmButtonColor: '#01a9ac',
confirmButtonText: 'OK'
}).then((result) => {
if (result.isConfirmed) {
if (response.role == 'Admin') {
window.location = 'admin/index.php';
} else if (response.role == 'Manager') {
window.location = 'admin/index.php';
} else if (response.role == 'Staff') {
window.location = 'staff/index.php';
} else {
Swal.fire({
icon: 'error',
text: 'Invalid user type or error',
confirmButtonColor: '#eb3422',
confirmButtonText: 'OK'
});
}
}
});
} else {
Swal.fire({
icon: 'error',
text: response.message,
confirmButtonColor: '#eb3422',
confirmButtonText: 'OK'
});
}
},
error: function(jqXHR, textStatus, errorThrown) {
console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
}
});
});
</script>
</body>
</html>