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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
|
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="Admin Dashboard" name="description" />
<meta content="" name="author" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Bestray</title>
<link rel="shortcut icon" href="assets/images/favicon.ico">
<link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="assets/alertifyjs/css/alertify.min.css" rel="stylesheet" type="text/css">
<link href="assets/alertifyjs/css/themes/default.min.css" rel="stylesheet" type="text/css">
<link href="assets/css/icons.css" rel="stylesheet" type="text/css">
<link href="assets/css/style.css" rel="stylesheet" type="text/css">
<script src="assets/js/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$('#btn_submit').on('click', function(){
console.log('Login button clicked');
url = "http://23.92.61.79:8082/api/session";
var email_id = $('#txt_email_id').val();
var password = $('#txt_password').val();
if(email_id == undefined || email_id.trim().length <= 0 || password == undefined || password.trim().length <= 0){
alertify.set('notifier','position', 'top-center');
alertify.error("Invalid Email ID or Password");
}else{
$.ajax({
async:false,
cache:false,
dataType:"json",
type: "POST",
url: url,
async: false,
data:{email:email_id,password:password},
success: function (response) {
console.log('Success: '+JSON.stringify(response));
alertify.success("Login success.Please wait...");
//window.location.href = 'main.jsp';
//$(location).attr('href', 'main.jsp');
// submit the form
$('form').attr('action','login');
$('form').submit();
},
error: function (response) {
console.log('Error: '+JSON.stringify(response));
alertify.set('notifier','position', 'top-center');
alertify.error("There has been an error.");
}
});
}
});
$('#btn_submit_reg').on('click', function(){
console.log('Register button clicked');
url = "http://23.92.61.79:8082/api/users/";
var user_name= $('#txt_user_name_reg').val();
var email_id = $('#txt_email_id_reg').val();
var password = $('#txt_password_reg').val();
if(
user_name== undefined || user_name.trim().length<= 0 ||
email_id == undefined || email_id.trim().length <= 0 ||
password == undefined || password.trim().length <= 0
){
$('#div_response').html("");
$('#div_response').html("Invalid inputs");
}else{
$.ajax({
async:false,
cache:false,
dataType:"json",
type: "post",
url: url,
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
},
data:JSON.stringify({name: user_name,email:email_id,password:password}),
success: function (response) {
console.log('Success: '+JSON.stringify(response));
$('#div_response').html("");
$('#div_response').html("Login success.Please wait...");
//window.location.href = 'main.jsp';
$(location).attr('href', 'index.jsp');
// submit the form
//$('form').attr('action','register');
//$('form').submit();
},
error: function (response) {
console.log('Error: '+JSON.stringify(response));
alertify.set('notifier','position', 'top-center');
alertify.error("There has been an error.");
}
});
}
});
});
</script>
</head>
<body style='background-image: url("images/back.jpg");background-repeat: no-repeat;width:100%; height:auto;'>
<!-- Begin page -->
<div class="accountbg"></div>
<div class="wrapper-page">
<div class="panel panel-color panel-primary panel-pages panel-login">
<div class="panel-body">
<h3 class="text-center m-t-0 m-b-15">
<a href="index.html" class="logo"><img
src="assets/images/01.png" alt="logo-img"></a>
</h3>
<!-- <form class="form-horizontal m-t-20" action="index.html"> -->
<!-- --------------------------- Login box -------------------------- -->
<form action="login" method="post">
<div class="login">
<h4 class="text-muted text-center m-t-0">
<b>Sign In</b>
</h4>
<div class="container">
<div class="form-group inp-field">
<div class="col-xs-12">
<input id="txt_email_id" name="txt_email_id"
class="form-control" type="text" required=""
placeholder="Email">
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<input id="txt_password" name="txt_password"
class="form-control" type="password" required=""
placeholder="Password">
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<div class="checkbox checkbox-primary">
<input id="checkbox-signup" type="checkbox" checked> <label
for="checkbox-signup"> Remember me </label>
</div>
</div>
</div>
<div class="form-group text-center m-t-40 ">
<div class="col-xs-12 ">
<button id="btn_submit" name="txt_submit"
class="btn btn-primary btn-block btn-lg waves-effect waves-light lgn_btn"
type="button">Login</button>
</div>
</div>
<div class="form-group m-t-30 m-b-0">
<div class="col-sm-8">
<!-- <a href="pages-recoverpw.html" class="text-muted"><i
class="fa fa-lock m-r-5"></i> Forgot your password?</a> -->
</div>
<div class="col-sm-4 text-right">
<a class="reg_btn text-muted" onclick="open_reg()"
style="cursor: pointer;">Register</a>
</div>
</div>
</div>
</div>
</form>
<!-- --------------------------- Login box end -------------------------- -->
<!-- --------------------------- Register box -------------------------- -->
<div class="reg" style="display: none;">
<h4 class="text-muted text-center m-t-0">
<b>Register</b>
</h4>
<div class="container">
<div class="form-group">
<div class="col-xs-12">
<input id="txt_email_id_reg" name="txt_email_id_reg" class="form-control" type="email" required=""
placeholder="Email">
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<input id="txt_user_name_reg" name="txt_user_name_reg" class="form-control" type="text" required=""
placeholder="Username">
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<input id="txt_password_reg" name="txt_password_reg" class="form-control" type="password" required=""
placeholder="Password">
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<input id="txt_cpassword_reg" name="txt_cpassword_reg" class="form-control" type="Confirm-password" required=""
placeholder="confirm-Password">
</div>
</div>
<!-- <span class="psw">Forgot <a href="#">password?</a></span>-->
</div>
<div class="form-group text-center m-t-40"
style="padding-bottom: 5px;">
<div class="col-xs-12">
<button id="btn_submit_reg" name="btn_submit_reg"
class="btn btn-primary btn-block btn-lg waves-effect waves-light lgn_btn"
type="button">Register</button>
</div>
<div class="form-group m-t-30 m-b-0">
<div class="col-sm-8"></div>
<div class="col-sm-4" style="padding-top: 15px;">
<a href="#" class="reg_btn text-muted" type="button"
onclick="open_reg()"><i class="fa fa-key m-r-5"></i>Login</a>
</div>
</div>
</div>
<!-- --------------------------- Register box end -------------------------- -->
<!-- </form> -->
</div>
</div>
</div>
<!-- jQuery -->
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/alertifyjs/alertify.min.js"></script>
<script src="assets/js/modernizr.min.js"></script>
<script src="assets/js/detect.js"></script>
<script src="assets/js/fastclick.js"></script>
<script src="assets/js/jquery.slimscroll.js"></script>
<script src="assets/js/jquery.blockUI.js"></script>
<script src="assets/js/waves.js"></script>
<script src="assets/js/wow.min.js"></script>
<script src="assets/js/jquery.nicescroll.js"></script>
<script src="assets/js/jquery.scrollTo.min.js"></script>
<script src="assets/js/app.js"></script>
</body>
</html>
|