-
Notifications
You must be signed in to change notification settings - Fork 3
/
myscript.js
89 lines (83 loc) · 2.22 KB
/
myscript.js
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
$(document).ready(function(){
$('#username').keypress(function(e){
$('#incorrectCredentials').css('visibilty','hidden');
if((e.which && e.which==13) || (e.keyCode && e.keycode==13))
{
loginFunction();
}
});
});
$(document).ready(function(){
$('#pwd').keypress(function(e){
$('#incorrectCredentials').css('visibilty','hidden');
if((e.which && e.which==13) || (e.keyCode && e.keycode==13))
{
loginFunction();
}
});
});
$(document).ready(function(){
$('#show_hide').on('click',function(){
var password=$('#pwd');
var btn=$('#show_hide');
var passwordtype=password.attr('type');
if(passwordtype=='password')
{
password.attr('type','text');
btn.find("i").removeClass("fa-eye").addClass("fa-eye-slash");
}
else
{
password.attr('type','password');
btn.find("i").removeClass("fa-eye-slash").addClass("fa-eye");
}
});
});
function loginFunction(e)
{
var rem="";
if($('#remember').is(":checked")){
rem="1";
}
else{
rem="0";
}
$.ajax({
type: 'POST',
url: 'pages/php/check.php',
data: { Username:$('#username').val(),Password:$('#pwd').val(),Remember:rem },
beforeSend: function() {
$('.loader').fadeIn();
},
success: function(response) {
if ( response.match(/aConfirmed/) )
{
window.location.href='pages/dashboard/dashboard.php';
}
else if ( response.match(/aUnconfirmed/) )
{
window.location.href='pages/php/change_password.php';
}
else if ( response.match(/Confirmed/) )
{
window.location.href='pages/dashboard/employee_dashboard.php';
}
else if ( response.match(/Unconfirmed/) )
{
window.location.href='pages/php/change_password_employee.php';
}
else if ( response.match(/username_problem/) )
{
$('.loader').fadeOut();
$('#pwd').focus();
$('#incorrectCredentials').css('visibility','visible');
}
else if ( response.match(/password_problem/) )
{
$('.loader').fadeOut();
$('#pwd').focus();
$('#incorrectCredentials').css('visibility','visible');
}
}
});
}