diff --git a/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php b/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php index 32ec481..3e40e96 100644 --- a/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php +++ b/app/Http/Controllers/APIs/RestaurantApi/RestAuthApiController.php @@ -126,12 +126,12 @@ class RestAuthApiController extends Controller 'required', 'string', 'email', - function ($attribute, $value, $fail) { - $existingUser = IamPrincipal::where('email_address', $value)->where('principal_type_xid', 4)->whereNull('deleted_at')->exists(); - if (!$existingUser) { - $fail('The selected email address is invalid.'); - } - }, + // function ($attribute, $value, $fail) { + // $existingUser = IamPrincipal::where('email_address', $value)->where('principal_type_xid', 4)->whereNull('deleted_at')->exists(); + // if (!$existingUser) { + // $fail('Entered e-mail address is not in our system.'); + // } + // }, ], ]); @@ -246,7 +246,4 @@ class RestAuthApiController extends Controller return jsonResponseWithErrorMessage(__('error_message.something_went_wrong'), 500); } } - - - } diff --git a/app/Services/APIs/RestaurantService/RestAuthApiService.php b/app/Services/APIs/RestaurantService/RestAuthApiService.php index dbef22b..c40a6e9 100644 --- a/app/Services/APIs/RestaurantService/RestAuthApiService.php +++ b/app/Services/APIs/RestaurantService/RestAuthApiService.php @@ -160,15 +160,19 @@ class RestAuthApiService { try { DB::beginTransaction(); + $user = IamPrincipal::where('email_address', $request->email_address) ->where('principal_type_xid', 4) ->whereNull('deleted_at') - ->first(); - //use this for both customer and restaurant just change principal_type_xid 4 - if ($user == null) { - Log::error('Email not exist'); - return jsonResponseWithErrorMessageApi(__('auth.incorrect_email'), 403); - } + ->exists(); + + + if (!$user) { + return jsonResponseWithDataErrorMessageApi(__('EmailNotExist'), ('Entered e-mail address is not in our system. Register for an account here.')); + + } + + // Define the generateOTP function $otp = $this->generateOTP(); diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php index 9b91dba..cd84533 100644 --- a/resources/lang/en/auth.php +++ b/resources/lang/en/auth.php @@ -114,6 +114,7 @@ return [ 'state_limit_reached' => 'You have reached the maximum limit for redeeming vouchers.', 'restaurant_limit_reached' => 'You have reached the maximum limit for redeeming vouchers.', 'email_already_used' => 'The email address is already in use.', + 'invalid_mail' => 'Entered e-mail address is not in our system. Register for an account here.', ];