/** * Handle the form. * * @param LoginFormBuilder $builder * @param UserAuthenticator $authenticator * @param Redirector $redirect */ public function handle(LoginFormBuilder $builder, UserAuthenticator $authenticator, Redirector $redirect) { if (!($user = $builder->getUser())) { return; } $authenticator->login($user, $builder->getFormValue('remember_me')); $builder->setFormResponse($redirect->intended($builder->getFormOption('redirect', '/'))); }
/** * Handle the form. * * @param LoginFormBuilder $builder * @param UserAuthenticator $authenticator * @param UserSecurity $security * @param Redirector $redirect */ public function handle(LoginFormBuilder $builder, UserAuthenticator $authenticator, UserSecurity $security, Redirector $redirect) { if (!($user = $builder->getUser())) { return; } $response = $security->check($user); if ($response instanceof Response) { $authenticator->logout($user); $builder->setFormResponse($response); return; } $authenticator->login($user, $builder->getFormValue('remember_me')); $builder->setFormResponse($redirect->intended($builder->getFormOption('redirect', '/'))); }