This commit is contained in:
sayliraut
2024-08-06 17:15:55 +05:30
parent 3a5d9cdd0d
commit 5dcd85f0d9
2 changed files with 15 additions and 16 deletions

View File

@@ -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('Entered e-mail address is not in our system.');
// }
// },
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.');
}
},
],
]);
@@ -246,4 +246,7 @@ class RestAuthApiController extends Controller
return jsonResponseWithErrorMessage(__('error_message.something_went_wrong'), 500);
}
}
}

View File

@@ -160,19 +160,15 @@ class RestAuthApiService
{
try {
DB::beginTransaction();
$user = IamPrincipal::where('email_address', $request->email_address)
->where('principal_type_xid', 4)
->whereNull('deleted_at')
->exists();
if (!$user) {
return jsonResponseWithDataErrorMessageApi(__('EmailNotExist'), ('Entered e-mail address is not in our system. Register for an account here.'));
}
->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);
}
// Define the generateOTP function
$otp = $this->generateOTP();