Updated validation functionality and failure messages in controller files

This commit is contained in:
dhanabalan
2025-07-05 18:25:11 +05:30
parent 3eb9f64fca
commit de0de426f0
7 changed files with 218 additions and 340 deletions

View File

@@ -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',