From a5159327e064d0d85b7659bfd1bed1cfe2f0bb56 Mon Sep 17 00:00:00 2001 From: sarog Date: Mon, 24 Apr 2023 19:36:36 +0300 Subject: [PATCH 1/2] fix: validation password has error when email doesn't contain the @ symbol --- .../Passwords/NothingPersonalValidator.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Authentication/Passwords/NothingPersonalValidator.php b/src/Authentication/Passwords/NothingPersonalValidator.php index 6a4102e6b..88c77f89c 100644 --- a/src/Authentication/Passwords/NothingPersonalValidator.php +++ b/src/Authentication/Passwords/NothingPersonalValidator.php @@ -72,10 +72,16 @@ protected function isNotPersonal(string $password, ?User $user): bool $needles = $this->strip_explode($userName); // extract local-part and domain parts from email as separate needles - [ - $localPart, - $domain, - ] = explode('@', $email); + if (str_contains($email, '@')) { + [ + $localPart, + $domain, + ] = explode('@', $email); + } else { + $localPart = $email; + $domain = null; + } + // might be john.doe@example.com and we want all the needles we can get $emailParts = $this->strip_explode($localPart); if (! empty($domain)) { From 82342125675ff3f82d0b75dd781bb87ec2dd52bd Mon Sep 17 00:00:00 2001 From: sarog Date: Mon, 24 Apr 2023 19:59:30 +0300 Subject: [PATCH 2/2] fix: validation password has error when email doesn't contain the @ symbol --- src/Authentication/Passwords/NothingPersonalValidator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Authentication/Passwords/NothingPersonalValidator.php b/src/Authentication/Passwords/NothingPersonalValidator.php index 88c77f89c..2d3c66fd9 100644 --- a/src/Authentication/Passwords/NothingPersonalValidator.php +++ b/src/Authentication/Passwords/NothingPersonalValidator.php @@ -79,7 +79,7 @@ protected function isNotPersonal(string $password, ?User $user): bool ] = explode('@', $email); } else { $localPart = $email; - $domain = null; + $domain = null; } // might be john.doe@example.com and we want all the needles we can get