Remove support for the "TYPE_AUTH_WILLLOGIN" event
Summary: Depends on D19903. Ref T13222. This was a Facebook-specific thing from D6202 that I believe no other install ever used, and I'm generally trying to move away from the old "event" system (the more modern modular/engine patterns generally replace it). Just drop support for this. Since the constant is being removed, anything that's actually using it should break in an obvious way, and I'll note this in the changelog. There's no explicit replacement but I don't think this hook is useful for anything except "being Facebook in 2013". Test Plan: - Grepped for `TYPE_AUTH_WILLLOGIN`. - Logged in. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13222 Differential Revision: https://secure.phabricator.com/D19904
This commit is contained in:
@@ -55,44 +55,29 @@ abstract class PhabricatorAuthController extends PhabricatorController {
|
||||
$response = $this->buildLoginValidateResponse($user);
|
||||
$session_type = PhabricatorAuthSession::TYPE_WEB;
|
||||
|
||||
$event_type = PhabricatorEventType::TYPE_AUTH_WILLLOGINUSER;
|
||||
$event_data = array(
|
||||
'user' => $user,
|
||||
'type' => $session_type,
|
||||
'response' => $response,
|
||||
'shouldLogin' => true,
|
||||
);
|
||||
|
||||
$event = id(new PhabricatorEvent($event_type, $event_data))
|
||||
->setUser($user);
|
||||
PhutilEventEngine::dispatchEvent($event);
|
||||
|
||||
$should_login = $event->getValue('shouldLogin');
|
||||
if ($should_login) {
|
||||
if ($force_full_session) {
|
||||
$partial_session = false;
|
||||
} else {
|
||||
$partial_session = true;
|
||||
}
|
||||
|
||||
$session_key = id(new PhabricatorAuthSessionEngine())
|
||||
->establishSession($session_type, $user->getPHID(), $partial_session);
|
||||
|
||||
// NOTE: We allow disabled users to login and roadblock them later, so
|
||||
// there's no check for users being disabled here.
|
||||
|
||||
$request = $this->getRequest();
|
||||
$request->setCookie(
|
||||
PhabricatorCookies::COOKIE_USERNAME,
|
||||
$user->getUsername());
|
||||
$request->setCookie(
|
||||
PhabricatorCookies::COOKIE_SESSION,
|
||||
$session_key);
|
||||
|
||||
$this->clearRegistrationCookies();
|
||||
if ($force_full_session) {
|
||||
$partial_session = false;
|
||||
} else {
|
||||
$partial_session = true;
|
||||
}
|
||||
|
||||
return $event->getValue('response');
|
||||
$session_key = id(new PhabricatorAuthSessionEngine())
|
||||
->establishSession($session_type, $user->getPHID(), $partial_session);
|
||||
|
||||
// NOTE: We allow disabled users to login and roadblock them later, so
|
||||
// there's no check for users being disabled here.
|
||||
|
||||
$request = $this->getRequest();
|
||||
$request->setCookie(
|
||||
PhabricatorCookies::COOKIE_USERNAME,
|
||||
$user->getUsername());
|
||||
$request->setCookie(
|
||||
PhabricatorCookies::COOKIE_SESSION,
|
||||
$session_key);
|
||||
|
||||
$this->clearRegistrationCookies();
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
protected function clearRegistrationCookies() {
|
||||
|
||||
@@ -22,7 +22,6 @@ final class PhabricatorEventType extends PhutilEventType {
|
||||
|
||||
const TYPE_PEOPLE_DIDRENDERMENU = 'people.didRenderMenu';
|
||||
const TYPE_AUTH_WILLREGISTERUSER = 'auth.willRegisterUser';
|
||||
const TYPE_AUTH_WILLLOGINUSER = 'auth.willLoginUser';
|
||||
const TYPE_AUTH_DIDVERIFYEMAIL = 'auth.didVerifyEmail';
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user