1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00

Fix an email address validation UI feedback issue when creating new users

Summary: On the "New User" web workflow, if you use an invalid email address, you get a failure with an empty message.

Test Plan:
  - Before: Tried to create a new user with address "asdf". Got no specific guidance.
  - After: Got specific guidance about email address formatting and length.

Differential Revision: https://secure.phabricator.com/D21264
This commit is contained in:
epriestley 2020-05-18 07:32:05 -07:00
parent 93b08f0e83
commit 7b0db3eb54

View file

@ -50,9 +50,12 @@ final class PhabricatorPeopleNewController
if (!strlen($new_email)) { if (!strlen($new_email)) {
$errors[] = pht('Email is required.'); $errors[] = pht('Email is required.');
$e_email = pht('Required'); $e_email = pht('Required');
} else if (!PhabricatorUserEmail::isAllowedAddress($new_email)) { } else if (!PhabricatorUserEmail::isValidAddress($new_email)) {
$errors[] = PhabricatorUserEmail::describeValidAddresses();
$e_email = pht('Invalid'); $e_email = pht('Invalid');
} else if (!PhabricatorUserEmail::isAllowedAddress($new_email)) {
$errors[] = PhabricatorUserEmail::describeAllowedAddresses(); $errors[] = PhabricatorUserEmail::describeAllowedAddresses();
$e_email = pht('Not Allowed');
} else { } else {
$e_email = null; $e_email = null;
} }