md5($plain), 2 => md5($parts[1].$plain), default => null, }; if ($computed === null) { return false; } return hash_equals($parts[0], $computed); } public static function upgradeToBcrypt(Authenticatable $customer, string $plain): void { $customer->password = Hash::make($plain); $customer->legacy_password = null; $customer->save(); } public static function attempt(Authenticatable $customer, string $plain): bool { $stored = (string) $customer->getAuthPassword(); try { if ($stored !== '' && Hash::check($plain, $stored)) { return true; } } catch (\Throwable) { // Magento hashes are not bcrypt; continue with the legacy verifier. } $legacy = (string) ($customer->legacy_password ?? ''); if ($legacy !== '' && self::verify($plain, $legacy)) { self::upgradeToBcrypt($customer, $plain); return true; } return false; } }