Differential D25211 Diff 707 src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php
Show First 20 Lines • Show All 178 Lines • ▼ Show 20 Lines | if ($request->isDialogFormPost()) { | ||||
return id(new AphrontReloadResponse())->setURI($uri); | return id(new AphrontReloadResponse())->setURI($uri); | ||||
} | } | ||||
PhabricatorSystemActionEngine::willTakeAction( | PhabricatorSystemActionEngine::willTakeAction( | ||||
array($viewer->getPHID()), | array($viewer->getPHID()), | ||||
new PhabricatorSettingsAddEmailAction(), | new PhabricatorSettingsAddEmailAction(), | ||||
1); | 1); | ||||
if (!strlen($email)) { | if (!phutil_nonempty_string($email)) { | ||||
$e_email = pht('Required'); | $e_email = pht('Required'); | ||||
valerio.bozzolan: 💚 I verifies that the `$email` comes from `AphrontRequest#getStr()` that always returns null or… | |||||
$errors[] = pht('Email is required.'); | $errors[] = pht('Email is required.'); | ||||
} else if (!PhabricatorUserEmail::isValidAddress($email)) { | } else if (!PhabricatorUserEmail::isValidAddress($email)) { | ||||
$e_email = pht('Invalid'); | $e_email = pht('Invalid'); | ||||
$errors[] = PhabricatorUserEmail::describeValidAddresses(); | $errors[] = PhabricatorUserEmail::describeValidAddresses(); | ||||
} else if (!PhabricatorUserEmail::isAllowedAddress($email)) { | } else if (!PhabricatorUserEmail::isAllowedAddress($email)) { | ||||
$e_email = pht('Disallowed'); | $e_email = pht('Disallowed'); | ||||
$errors[] = PhabricatorUserEmail::describeAllowedAddresses(); | $errors[] = PhabricatorUserEmail::describeAllowedAddresses(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 219 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
💚 I verifies that the $email comes from AphrontRequest#getStr() that always returns null or a string.
The function phutil_nonempty_string() will report alien types (such as objects), and that extra check is OK here.