Some logging and return 404 when not ready
This commit is contained in:
parent
a473a50341
commit
8f8b50d630
@ -70,7 +70,6 @@ class Nonce
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log::debug(sprintf('A: %s, B: %s',$o->created_at->diffInMinutes(Carbon::now()),config('sqrl.nonce_age')));
|
|
||||||
// Delete the old nonce
|
// Delete the old nonce
|
||||||
if ($o->created_at->diffInMinutes(Carbon::now()) > config('sqrl.nonce_age')) {
|
if ($o->created_at->diffInMinutes(Carbon::now()) > config('sqrl.nonce_age')) {
|
||||||
$o->delete();
|
$o->delete();
|
||||||
|
@ -138,6 +138,8 @@ class SQRLController extends Controller
|
|||||||
|
|
||||||
// If the nonce is old or doesnt exist.
|
// If the nonce is old or doesnt exist.
|
||||||
if (! $o) {
|
if (! $o) {
|
||||||
|
Log::debug(sprintf('isReady: Invalid Nonce [%s]',$request->get('nut')));
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'isReady'=>FALSE,
|
'isReady'=>FALSE,
|
||||||
'msg'=>'Invalid Nonce, or Nonce expired'
|
'msg'=>'Invalid Nonce, or Nonce expired'
|
||||||
@ -146,6 +148,8 @@ class SQRLController extends Controller
|
|||||||
|
|
||||||
// Validate the IP matches - since the request would come from the same device client
|
// Validate the IP matches - since the request would come from the same device client
|
||||||
if ($o->ip !== $request->ip()) {
|
if ($o->ip !== $request->ip()) {
|
||||||
|
Log::debug(sprintf('isReady: IP Mismatch [%s] != [%s]',$o->ip,$request->ip));
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'isReady'=>FALSE,
|
'isReady'=>FALSE,
|
||||||
'msg' => 'IP Mismatch',
|
'msg' => 'IP Mismatch',
|
||||||
@ -154,13 +158,17 @@ class SQRLController extends Controller
|
|||||||
|
|
||||||
// Has the nonce be validated
|
// Has the nonce be validated
|
||||||
if ($o->verified != 1) {
|
if ($o->verified != 1) {
|
||||||
|
Log::debug(sprintf('isReady: Not Verified [%s]',$o->verified));
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'isReady'=>FALSE,
|
'isReady'=>FALSE,
|
||||||
'msg'=>'Not Ready'
|
'msg'=>'Not Ready'
|
||||||
],200);
|
],404);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($o->pubkey && $o->pubkey->disabled) {
|
if ($o->pubkey && $o->pubkey->disabled) {
|
||||||
|
Log::debug(sprintf('isReady: SQRL Disabled [%s]',$o->pubkey));
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'isReady'=>FALSE,
|
'isReady'=>FALSE,
|
||||||
'msg'=>'SQRL disabled for user'
|
'msg'=>'SQRL disabled for user'
|
||||||
@ -169,6 +177,8 @@ class SQRLController extends Controller
|
|||||||
|
|
||||||
switch ($o->type) {
|
switch ($o->type) {
|
||||||
case 'auth':
|
case 'auth':
|
||||||
|
Log::debug(sprintf('isReady: Authenticated [%s]',$o->pubkey));
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'isReady'=>TRUE,
|
'isReady'=>TRUE,
|
||||||
'msg'=>'SQRL authenticated',
|
'msg'=>'SQRL authenticated',
|
||||||
@ -180,10 +190,12 @@ class SQRLController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Log::debug(sprintf('isReady: Not Nut?',$request->get('nut')));
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'isReady'=>FALSE,
|
'isReady'=>FALSE,
|
||||||
'msg'=>'Not Found!'
|
'msg'=>'Not Found!'
|
||||||
],404);
|
],200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user