Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/storage/PhabricatorUserEmail.php
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | public static function isValidAddress($address) { | ||||
// - `PhutilEmailAddress` needs to be able to extract the domain portion | // - `PhutilEmailAddress` needs to be able to extract the domain portion | ||||
// from it. | // from it. | ||||
// - Reasonable mail adapters should be hard-pressed to interpret one | // - Reasonable mail adapters should be hard-pressed to interpret one | ||||
// address as several addresses. | // address as several addresses. | ||||
// | // | ||||
// To this end, we're roughly verifying that there's some normal text, an | // To this end, we're roughly verifying that there's some normal text, an | ||||
// "@" symbol, and then some more normal text. | // "@" symbol, and then some more normal text. | ||||
$email_regex = '(^[a-z0-9_+.!-]+@[a-z0-9_+:.-]+$)i'; | $email_regex = '(^[a-z0-9_+.!-]+@[a-z0-9_+:.-]+\z)i'; | ||||
if (!preg_match($email_regex, $address)) { | if (!preg_match($email_regex, $address)) { | ||||
return false; | return false; | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 185 Lines • Show Last 20 Lines |