mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-30 05:58:12 +02: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:
parent
a5f6e19dfd
commit
f7b1ed7221
1 changed files with 7 additions and 2 deletions
|
@ -57,8 +57,13 @@ final class PhabricatorAuthRegisterController
|
||||||
|
|
||||||
$default_username = $account->getUsername();
|
$default_username = $account->getUsername();
|
||||||
$default_realname = $account->getRealName();
|
$default_realname = $account->getRealName();
|
||||||
|
|
||||||
$default_email = $account->getEmail();
|
$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
|
// If the account source provided an email, but it's not allowed by
|
||||||
// the configuration, roadblock the user. Previously, we let the user
|
// the configuration, roadblock the user. Previously, we let the user
|
||||||
// pick a valid email address instead, but this does not align well with
|
// 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 T3340.
|
||||||
// TODO: See T3472.
|
// TODO: See T3472.
|
||||||
|
|
||||||
if ($default_email) {
|
if ($default_email !== null) {
|
||||||
$same_email = id(new PhabricatorUserEmail())->loadOneWhere(
|
$same_email = id(new PhabricatorUserEmail())->loadOneWhere(
|
||||||
'address = %s',
|
'address = %s',
|
||||||
$default_email);
|
$default_email);
|
||||||
|
|
Loading…
Add table
Reference in a new issue