login.blade.php
12.8 KB
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
<?php
use \App\Models\User;
if(Input::get('sendotp')=="1")
{
$otpuser=trim(Input::get('otpuser'));
$user=User::where('username','=',$otpuser)->first();
if($user)
{
$otpemail=$user->email;
$otp=rand(100000, 999999);
$user->password=Hash::make($otp);
$meta=$user->meta();
if(!isset($meta['otp_array']))$meta['otp_array']=array();
if(!isset($meta['otp_array'][date('Ymd')])){$meta['otp_array']=array();$meta['otp_array'][date('Ymd')]=0;}
$meta['otp_array'][date('Ymd')]++;
if($meta['otp_array'][date('Ymd')]<=3)
{
$user->meta=json_encode($meta);
$user->save();
Mail::send('emails.notification',
array(
'heloname'=>'',
'line1'=>'Your OTP for Login : '.$otp.' ',
'line2'=>'Please visit <a href="'.URL::to('/').'"><b>'.Config::get("app.name").' </b></a> and You can login using this OTP.',
'line3'=>'',
'notifytype'=>'OTP'), function($message) use ($otpemail)
{
$message->to($otpemail,$otpemail);
$message->subject(Config::get("app.name")." OTP for Login");
});
echo "$(\"#alertdiv\").html('<div class=\"alert alert-success\"><button type=button class=close data-dismiss=alert>×</button><strong>Success</strong> OTP Sent to ($otpemail)</div>');";
}
else echo "$(\"#alertdiv\").html('<div class=\"alert alert-danger\"><button type=button class=close data-dismiss=alert>×</button><strong>Failed</strong> Too many reuests ($otpemail), please try after 24 hrs</div>');";
}
else echo "$(\"#alertdiv\").html('<div class=\"alert alert-danger\"><button type=button class=close data-dismiss=alert>×</button><strong>Failed</strong> Invalid User </div>');";
}
else
{
?>
@include('layout.header')
<style>
body {
background: url(assets/images/main.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.layout-app .col-separator{
background: url(assets/images/main.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
html.app .layout-app .col-separator{
margin:0px !important;
}
.blur_bg{
}
html.app .layout-app{
top: 0px;
bottom: 0px;
}
.login{
background: #fff;
border-radius: 2px;
top: 15%;
-webkit-box-shadow: 0px 7px 22px 0px rgb(131, 151, 167);
-moz-box-shadow: 0px 7px 22px 0px rgb(131, 151, 167);
box-shadow: 0px 7px 22px 0px rgb(131, 151, 167);
}
.login_head{
background: #fff;
border-radius: 2px 2px 0px 0;
margin: 0 -5px;
}
.login_head img{
margin: 0 auto;
display: block;
padding: 20px 0px 0px;
border: 0px;
height:70px;
}
.login_head span{
color: #505050;
display: block;
text-align: center;
margin-top: 10px;
font-size: 15px;
text-transform: uppercase;
font-weight: 600;
}
.login_head p{
font-family: 'Open-Sans', sans-serif;
font-weight: 400;
line-height: 30px;
font-size: 15px;
color: #505050;
-webkit-box-shadow: inset 0px -2px 10px -8px rgba(20,20,20,1);
-moz-box-shadow: inset 0px -2px 10px -8px rgba(20,20,20,1);
box-shadow: inset 0px -2px 10px -8px rgba(20,20,20,1);
}
.panel{
background: transparent;
border: 0px;
box-shadow: 0 0px 0px rgba(0, 0, 0, 0.05);
-webkit-box-shadow: 0 0px 0px rgba(0, 0, 0, 0.05);
}
.form-control::-webkit-input-placeholder {
color: #5F5F5F;
}
.form-control:-moz-placeholder {
color: #5F5F5F;
}
.form-control::-moz-placeholder {
color: #5F5F5F;
}
.form-control:-ms-input-placeholder {
color: #5F5F5F;
}
.form-control{
background: transparent;
border: 0px;
border-bottom: 1px solid #5F5F5F !important;
font-weight: 600;
}
input[type="text"]:focus, input[type="text"]:active, input[type="text"]:hover{
background: transparent;
font-weight: 900;
}
input[type="text"], input[type="password"], select, textarea{
color: #5F5F5F;
}
.login_btn{
margin-top: 40px;
border-radius: 0px;
background: #4B9DD8;
border: 0px;
padding: 10px;
font-weight: 600;
text-transform: uppercase;
color: #fff;
}
.login_btn:hover, .login_btn:active, .login_btn:focus{
background: #8DC4EA;
color: #fff
}
.login_otp{
width: 30%;
border-radius: 0px;
background: #5F5F5F;
border: 0px;
padding: 10px;
font-weight: 600;
text-transform: uppercase;
color: #FFFFFF;
font-size: 12px;
}
.login_otp:hover, .login_otp:active, .login_otp:focus{
border:1px solid #5F5F5F;
color: #5F5F5F;
padding:9px 10px;
}
.alternate_login{
margin-top: 30px;
}
/* .alternate_login label{
background: #89ceff;
padding: 10px 20px;
border-radius: 2px;
}*/
.alternate_login label a{
color: #4B9DD8;
}
.alternate_login label a:hover{
color:#5B86A5;
}
.or_div{
line-height: 0.5;
text-align: center;
width: 100%;
margin-top: 20px;
}
.or_div p{
display: inline-block;
position: relative;
color: #505050;
font-weight: 600;
border: 1px solid #505050;
width: 40px;
height: 40px;
line-height: 40px;
border-radius: 50%;
}
.or_div p:before, .or_div p:after{
content: "";
position: absolute;
height: 5px;
border-bottom: 1px solid #7D7D7D;
top: 15px;
width: 130px;
}
.or_div p:before{
right: 100%;
}
.or_div p:after{
left: 100%;
}
.alert.alert-danger {
background: none repeat scroll 0 0 #F95B5B;
border-color: #F95B5B;
color: #ffffff;
border-radius: 0;
padding: 10px;
}
.alert.alert-warning{
background: none repeat scroll 0 0 #FFA84F;
border-color: #FFA84F;
color: #ffffff;
border-radius: 0;
padding: 10px;
}
</style>
<div class="layout-app" style="height: 100%;"><!-- row-app -->
<div class="row row-app" style="height: 100%;">
<!-- col -->
<!-- col-separator.box -->
<div class="col-separator col-unscrollable box" style="height: 100%;">
<!-- col-table -->
<div class="col-table blur_bg" style="height: 100%;">
<!-- col-table-row -->
<div class="col-table-row" style="height: 100%;">
<!-- col-app -->
<div class="col-app col-unscrollable" style="height: 100%;">
<!-- col-app -->
<div class="col-app" style="height: 100%;">
<div class="login col-sm-4 col-sm-offset-4">
<div class="login_head">
<img src="custom/logo.png">
<p class="innerAll margin-none text-center hidden-xs">Login to your account</p>
</div>
<div class="panel panel-default col-sm-12">
<div class="panel-body">
<div id='alertdiv'>
<?php
$class="";
$type="";
$msg="";
if(isset($error))
{
if($error=="activationsuccess"){$class="success";$type="Verified!";$msg="Congratulations, your account is now active, please login to continue.";}
else if($error=="authfailed"){$class="danger";$type="Login Failed!";$msg="Incorrect Email id or password.";}
else if($error=="Unverified"){$class="danger";$type="Verification Required!";$msg="We have sent a verification mail to your email id, please follow instructions in the mail.";}
else if($error=="alreadyverified"){$class="warning";$type="Already Verified!";$msg="You have already verified your account.";}
else if($error=="msie"){$class="info";$type="Internet Explorer Detected!";$msg="This application doesnot work with MS Internet explorer, please download <a href='http://firefox.com' target=_BLANK>Mozilla Firefox</a> or <a href='http://google.com/chrome' target=_BLANK>Google Chrome</a> to use.";}
else if($error=="forgotpassword"){$class="info";$type="Password Reminder Sent";$msg="Please check your email for instructions to login to your account. Thankyou";}
else if($error=="passwordchanged"){$class="success";$type="Password Changed successfully";$msg="You can now login with your new password below!";}
else if($error=="resetexpired"){$class="danger";$type="Link Expired";$msg="The Link You used is now Expired!";}
else if($error=="Disabled"){$class="danger";$type="Disabled";$msg="This user account has been disabled, please contact Support!";}
else {$class="danger";$type="Failed!";$msg="Unknown Error. Method not found";}
?>
<!-- Alert -->
<div class="alert alert-{!!$class!!}">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>{!!$type!!}</strong> {!!$msg!!}
</div>
<!-- // Alert END -->
<?php } ?>
</div>
<form role="form" action="login" method=post id=owaform>
<input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
<div class="form-group">
<!-- <label for="exampleInputEmail1">Login ID <?php if(Config::get("app.extAuth")=="owa")echo "(Domain Login)"; ?></label> -->
<input type="text" class="form-control" id="exampleInputEmail1" name=username placeholder="Login ID">
</div>
<div class="form-group">
<!-- <label for="exampleInputPassword1">Password</label> -->
<input type="password" class="form-control" id="exampleInputPassword1" name=password placeholder="Password">
</div>
<button type="submit" class="btn btn-primary btn-block login_btn">Login</button>
<!-- <button type="button" onclick='document.location="signup";' class="btn btn-primary btn-block">Signup</button> -->
<!-- <div class="or_div"><p>OR</p></div> -->
<div class="alternate_login">
<label class="pull-left"><a href='#' onclick='$("#owaform").hide();$("#otpform").show();return false;'>Alternate login via OTP</a></label>
<label class="pull-right"><a href='mailto:{!!Config::get("app.email")!!}' class='pull-right'>Contact Support</a></label>
</div>
</form>
<form role="form" action="login" method=post id=otpform style='display:none'>
<input type="hidden" name="_token" value="{{{ csrf_token() }}}" />
<input type="hidden" name="otplogin" value="true" />
<div class="form-group">
<input type="text" class="form-control" style="width:70%;float: left;margin-top: 3px;" id="exampleInputEmail2" name="username" placeholder="UserName">
<button type="button" class="btn btn-primary btn-block login_otp" onclick='getOTP();return false;'>Get OTP</button>
</div>
<div class="form-group">
<!-- <label for="exampleInputPassword2">Enter OTP</label>-->
<input type="password" class="form-control" id="exampleInputPassword2" name=password placeholder="Enter otp">
</div>
<button type="submit" class="btn btn-primary btn-block login_btn">Login</button>
<!-- <button type="button" onclick='document.location="signup";' class="btn btn-primary btn-block">Signup</button> -->
<div class="alternate_login">
<label>
<a href='#' onclick='$("#owaform").show();$("#otpform").hide();return false;'>Back to Login</a>
</label>
</div>
</form>
</div>
</div>
<!-- <div class="col-sm-2 col-sm-4 col-sm-offset-4 text-center">
<a href="signup" class="btn btn-info">Create a new account? <i class="fa fa-pencil"></i> </a>
</div>-->
</div>
</div>
<!-- // END col-app -->
</div>
<!-- // END col-app.col-unscrollable -->
</div>
<!-- // END col-table-row -->
</div>
<!-- // END col-table -->
</div>
<!-- // END col-separator.box -->
</div>
<!-- // END row-app -->
<script>
function getOTP()
{
var username=$("#exampleInputEmail2").val();
$("#alertdiv").html('<div class="alert alert-warning"><button type="button" class="close" data-dismiss="alert">×</button><strong>Please Wait..</strong> Sending OTP for User ('+username+')</div>');
doAjax('login?sendotp=1&otpuser='+username,'','','ajax_login_otp','singlefail','GET',function(){
});
}
</script>
@include('layout.footer')
<?php
}
?>