コード例 #1
0
 /**
  * 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', '/')));
 }
コード例 #2
0
 /**
  * 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', '/')));
 }