-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
75 lines (73 loc) · 2.85 KB
/
login.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
<style>
#uni_modal .modal-content>.modal-footer,#uni_modal .modal-content>.modal-header{
display:none;
}
</style>
<div class="container-fluid">
<div class="row">
<h3 class="float-right">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</h3>
<div class="col-lg-12">
<h3 class="text-center">Login</h3>
<hr>
<form action="" id="login-form">
<div class="form-group">
<label for="" class="control-label">Email</label>
<input type="email" class="form-control form" name="email" required>
</div>
<div class="form-group">
<label for="" class="control-label">Password</label>
<input type="password" class="form-control form" name="password" required>
</div>
<div class="form-group d-flex justify-content-between">
<a href="javascript:void()" id="create_account">Create Account</a>
<button class="btn btn-primary btn-flat">Login</button>
</div>
</form>
</div>
</div>
</div>
<script>
$(function(){
$('#create_account').click(function(){
uni_modal("","registration.php","mid-large")
})
$('#login-form').submit(function(e){
e.preventDefault();
start_loader()
if($('.err-msg').length > 0)
$('.err-msg').remove();
$.ajax({
url:_base_url_+"classes/Login.php?f=login_user",
method:"POST",
data:$(this).serialize(),
dataType:"json",
error:err=>{
console.log(err)
alert_toast("an error occured",'error')
end_loader()
},
success:function(resp){
if(typeof resp == 'object' && resp.status == 'success'){
alert_toast("Login Successfully",'success')
setTimeout(function(){
location.reload()
},2000)
}else if(!!resp.msg){
var _err_el = $('<div>')
_err_el.addClass("alert alert-danger err-msg").text(resp.msg)
$('#login-form').prepend(_err_el)
end_loader()
}else{
console.log(resp)
alert_toast("an error occured",'error')
end_loader()
}
}
})
})
})
</script>