From 7b0db3eb54b9ba948f836d400b73fd625ad6158b Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 18 May 2020 07:32:05 -0700 Subject: [PATCH] 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 --- .../people/controller/PhabricatorPeopleNewController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/applications/people/controller/PhabricatorPeopleNewController.php b/src/applications/people/controller/PhabricatorPeopleNewController.php index 44dfe0e8a6..858ebef234 100644 --- a/src/applications/people/controller/PhabricatorPeopleNewController.php +++ b/src/applications/people/controller/PhabricatorPeopleNewController.php @@ -50,9 +50,12 @@ final class PhabricatorPeopleNewController if (!strlen($new_email)) { $errors[] = pht('Email is required.'); $e_email = pht('Required'); - } else if (!PhabricatorUserEmail::isAllowedAddress($new_email)) { + } else if (!PhabricatorUserEmail::isValidAddress($new_email)) { + $errors[] = PhabricatorUserEmail::describeValidAddresses(); $e_email = pht('Invalid'); + } else if (!PhabricatorUserEmail::isAllowedAddress($new_email)) { $errors[] = PhabricatorUserEmail::describeAllowedAddresses(); + $e_email = pht('Not Allowed'); } else { $e_email = null; }