Fix FLEXIAPI-269 Update the IsNotPhoneNumber rule to use a better phone number validator

This commit is contained in:
Timothée Jaussoin 2025-02-13 11:58:44 +01:00
parent 573c505280
commit 21ff64cf2f
2 changed files with 3 additions and 1 deletions

View file

@ -20,6 +20,7 @@ v1.6
- Fix FLEXIAPI-262 Bypass the JWT auth if we have an API Key
- Fix FLEXIAPI-264 Add -k|api_key_ip parameter to accounts:create-admin-account to set/clear the related API Key restriction
- 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.5
---

View file

@ -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()