Add a blanket "will login" event

Summary:
Ref T1536. Facebook currently does a check which should be on-login in registration hooks, and this is generally a reasonable hook to provide.

The "will login" event allows listeners to reject or modify a login, or just log it or whatever.

NOTE: This doesn't cover non-web logins right now -- notably Conduit. That's presumably fine.

(This can't land for a while, it depends on about 10 uncommitted revisions.)

Test Plan: Logged out and in again.

Reviewers: wez, btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1536

Differential Revision: https://secure.phabricator.com/D6202
This commit is contained in:
epriestley
2013-06-16 16:35:36 -07:00
parent 0250b48c05
commit 61a0c6d6e3
9 changed files with 64 additions and 29 deletions

View File

@@ -205,13 +205,11 @@ final class PhabricatorAuthRegisterController
$user->saveTransaction();
$this->establishWebSession($user);
if (!$email_obj->getIsVerified()) {
$email_obj->sendVerificationEmail($user);
}
return $this->buildLoginValidateResponse($user);
return $this->loginUser($user);
} catch (AphrontQueryDuplicateKeyException $exception) {
$same_username = id(new PhabricatorUser())->loadOneWhere(
'userName = %s',
@@ -480,7 +478,7 @@ final class PhabricatorAuthRegisterController
}
}
private function renderError($message) {
protected function renderError($message) {
return $this->renderErrorPage(
pht('Registration Failed'),
array($message));