1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-03-27 03:30:16 +01:00

Fix two registration errors for unusual provider emails

Summary:
See <https://github.com/facebook/phabricator/issues/541>.

  - If a provider returns the email `""` or `"0"`, we currently don't let the user edit it and thus don't let them register.
  - If a provider returns an invalid email like `"!!!"` (permitted by GitHub, e.g.), we show them a nonsense error message.

Instead:

  - Pretend we didn't get an address if we get an invalid address.
  - Test the address strictly against `null`.

Test Plan: Registered on Phabricator with my GitHub email set to `""` (empty string) and `"!!!"` (bang bang bang).

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: aran, epriestley

Differential Revision: https://secure.phabricator.com/D8528
This commit is contained in:
epriestley 2014-03-13 19:03:12 -07:00
parent a5f6e19dfd
commit f7b1ed7221

View file

@ -57,8 +57,13 @@ final class PhabricatorAuthRegisterController
$default_username = $account->getUsername();
$default_realname = $account->getRealName();
$default_email = $account->getEmail();
if ($default_email) {
if (!PhabricatorUserEmail::isValidAddress($default_email)) {
$default_email = null;
}
if ($default_email !== null) {
// If the account source provided an email, but it's not allowed by
// the configuration, roadblock the user. Previously, we let the user
// pick a valid email address instead, but this does not align well with
@ -84,7 +89,7 @@ final class PhabricatorAuthRegisterController
// TODO: See T3340.
// TODO: See T3472.
if ($default_email) {
if ($default_email !== null) {
$same_email = id(new PhabricatorUserEmail())->loadOneWhere(
'address = %s',
$default_email);