示例#1
0
 /**
  * Log user in
  *
  * @param User $user
  * @param $login
  * @throws IllegalObjectTypeException
  */
 protected function loginPreflight(User $user, $login)
 {
     if ($login) {
         // persist user (otherwise login may not be possible)
         $this->userRepository->update($user);
         $this->persistenceManager->persistAll();
         if ($this->config['new.']['login'] === '1') {
             UserUtility::login($user, $this->allConfig['persistence']['storagePid']);
             $this->addFlashMessage(LocalizationUtility::translate('login'), '', FlashMessage::NOTICE);
         }
     }
 }
示例#2
0
 /**
  * Simulate frontenduser login for backend adminstrators only
  *
  * @param User $user
  * @throws UnauthorizedException
  * @return void
  */
 public function loginAsAction(User $user)
 {
     if (!BackendUserUtility::isAdminAuthentication()) {
         throw new UnauthorizedException(LocalizationUtility::translate('error_not_authorized'));
     }
     UserUtility::login($user);
     $this->redirectByAction('loginAs', 'redirect');
     $this->redirectToUri('/');
 }