From b66cc28004c5ab069628919e2133abc72e3d4960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Jaussoin?= Date: Thu, 13 Feb 2025 11:58:44 +0100 Subject: [PATCH] Fix FLEXIAPI-269 Update the IsNotPhoneNumber rule to use a better phone number validator --- CHANGELOG.md | 1 + flexiapi/app/Rules/IsNotPhoneNumber.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a74d63f..0e633f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ v1.7 - Fix FLEXIAPI-264 Add -k|api_key_ip parameter to accounts:create-admin-account to set/clear the related API Key restriction - Fix FLEXIAPI-256 Publish an empty string while deleting a device on Redis to force the refresh on the other clients - Fix FLEXIAPI-268 Allow pn-param in Apple format for the push notifications endpoints +- Fix FLEXIAPI-269 Update the IsNotPhoneNumber rule to use a better phone number validator v1.6 ---- diff --git a/flexiapi/app/Rules/IsNotPhoneNumber.php b/flexiapi/app/Rules/IsNotPhoneNumber.php index 07e1e5e..569b20b 100644 --- a/flexiapi/app/Rules/IsNotPhoneNumber.php +++ b/flexiapi/app/Rules/IsNotPhoneNumber.php @@ -4,12 +4,13 @@ namespace App\Rules; use Illuminate\Contracts\Validation\Rule; use Respect\Validation\Validator; +use Propaganistas\LaravelPhone\PhoneNumber; class IsNotPhoneNumber implements Rule { public function passes($attribute, $value): bool { - return (Validator::not(Validator::phone())->not(Validator::startsWith('+'))->validate($value)); + return (new PhoneNumber($value))->getCountry() == null; } public function message()