Updated validation functionality and failure messages in controller files
This commit is contained in:
@@ -37,7 +37,7 @@ class UserController extends Controller
|
||||
$header_pass = $request->header('User-Pass');
|
||||
$expectedToken = $expectedUser . ':' . $expectedPw;
|
||||
|
||||
if ("Bearer " . $expectedToken !== $header_auth)
|
||||
if ("Bearer " . $expectedToken != $header_auth)
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
@@ -52,6 +52,13 @@ class UserController extends Controller
|
||||
'status_description' => 'Invalid user name found!'
|
||||
], 400);
|
||||
}
|
||||
else if (!$header_pass)
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid password found!'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$existUser = User::where('name', $header_user)->first();
|
||||
|
||||
@@ -62,7 +69,7 @@ class UserController extends Controller
|
||||
'status_description' => 'Unknown user name found!'
|
||||
], 400);
|
||||
}
|
||||
// if ($header_user !== $existUser->name)
|
||||
// if ($header_user != $existUser->name)
|
||||
// {
|
||||
// return response()->json([
|
||||
// 'status_code' => 'ERROR',
|
||||
|
||||
Reference in New Issue
Block a user