From 02d6343920cdedca21a92674470f09dc89f8c204 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Mon, 15 May 2023 19:55:46 +0800 Subject: [PATCH] fix: simplify extraction of email parts --- .../Passwords/NothingPersonalValidator.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/Authentication/Passwords/NothingPersonalValidator.php b/src/Authentication/Passwords/NothingPersonalValidator.php index ef11ffbae..92151e8b0 100644 --- a/src/Authentication/Passwords/NothingPersonalValidator.php +++ b/src/Authentication/Passwords/NothingPersonalValidator.php @@ -72,15 +72,8 @@ protected function isNotPersonal(string $password, ?User $user): bool $needles = $this->strip_explode($userName); // extract local-part and domain parts from email as separate needles - if (str_contains($email, '@')) { - [ - $localPart, - $domain, - ] = explode('@', $email); - } else { - $localPart = $email; - $domain = null; - } + [$localPart, $domain] = explode('@', $email) + [1 => null]; + // might be john.doe@example.com and we want all the needles we can get $emailParts = $this->strip_explode($localPart); if (! empty($domain)) {