Esempio n. 1
0
 /**
  * set the login name
  *
  * @param string|null $loginName for the logged in user
  */
 public function setLoginName($loginName)
 {
     if (is_null($loginName)) {
         $this->session->remove('loginname');
     } else {
         $this->session->set('loginname', $loginName);
     }
 }
Esempio n. 2
0
 /**
  * remove keys from session
  */
 public function clear()
 {
     $this->session->remove('publicSharePrivateKey');
     $this->session->remove('privateKey');
     $this->session->remove('encryptionInitialized');
     $this->session->remove('decryptAll');
     $this->session->remove('decryptAllKey');
     $this->session->remove('decryptAllUid');
 }
Esempio n. 3
0
 /**
  * Verify the given challenge
  *
  * @param string $providerId
  * @param IUser $user
  * @param string $challenge
  * @return boolean
  */
 public function verifyChallenge($providerId, IUser $user, $challenge)
 {
     $provider = $this->getProvider($user, $providerId);
     if (is_null($provider)) {
         return false;
     }
     $result = $provider->verifyChallenge($user, $challenge);
     if ($result) {
         $this->session->remove(self::SESSION_UID_KEY);
     }
     return $result;
 }
Esempio n. 4
0
 /**
  * @PublicPage
  * @NoCSRFRequired
  * @UseSession
  *
  * @param string $user
  * @param string $redirect_url
  * @param string $remember_login
  *
  * @return TemplateResponse|RedirectResponse
  */
 public function showLoginForm($user, $redirect_url, $remember_login)
 {
     if ($this->userSession->isLoggedIn()) {
         return new RedirectResponse(OC_Util::getDefaultPageUrl());
     }
     $parameters = array();
     $loginMessages = $this->session->get('loginMessages');
     $errors = [];
     $messages = [];
     if (is_array($loginMessages)) {
         list($errors, $messages) = $loginMessages;
     }
     $this->session->remove('loginMessages');
     foreach ($errors as $value) {
         $parameters[$value] = true;
     }
     $parameters['messages'] = $messages;
     if (!is_null($user) && $user !== '') {
         $parameters['loginName'] = $user;
         $parameters['user_autofocus'] = false;
     } else {
         $parameters['loginName'] = '';
         $parameters['user_autofocus'] = true;
     }
     if (!empty($redirect_url)) {
         $parameters['redirect_url'] = $redirect_url;
     }
     $parameters['canResetPassword'] = true;
     $parameters['resetPasswordLink'] = $this->config->getSystemValue('lost_password_link', '');
     if (!$parameters['resetPasswordLink']) {
         if (!is_null($user) && $user !== '') {
             $userObj = $this->userManager->get($user);
             if ($userObj instanceof IUser) {
                 $parameters['canResetPassword'] = $userObj->canChangePassword();
             }
         }
     }
     $parameters['alt_login'] = OC_App::getAlternativeLogIns();
     $parameters['rememberLoginAllowed'] = OC_Util::rememberLoginAllowed();
     $parameters['rememberLoginState'] = !empty($remember_login) ? $remember_login : 0;
     if (!is_null($user) && $user !== '') {
         $parameters['loginName'] = $user;
         $parameters['user_autofocus'] = false;
     } else {
         $parameters['loginName'] = '';
         $parameters['user_autofocus'] = true;
     }
     return new TemplateResponse($this->appName, 'login', $parameters, 'guest');
 }
 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  * @UseSession
  *
  * @param string $challengeProviderId
  * @param string $redirect_url
  * @return TemplateResponse
  */
 public function showChallenge($challengeProviderId, $redirect_url)
 {
     $user = $this->userSession->getUser();
     $provider = $this->twoFactorManager->getProvider($user, $challengeProviderId);
     if (is_null($provider)) {
         return new RedirectResponse($this->urlGenerator->linkToRoute('core.TwoFactorChallenge.selectChallenge'));
     }
     if ($this->session->exists('two_factor_auth_error')) {
         $this->session->remove('two_factor_auth_error');
         $error = true;
     } else {
         $error = false;
     }
     $tmpl = $provider->getTemplate($user);
     $tmpl->assign('redirect_url', $redirect_url);
     $data = ['error' => $error, 'provider' => $provider, 'logout_attribute' => $this->getLogoutAttribute(), 'template' => $tmpl->fetchPage()];
     return new TemplateResponse($this->appName, 'twofactorshowchallenge', $data, 'guest');
 }
Esempio n. 6
0
 /**
  * Removes the current token.
  */
 public function removeToken()
 {
     $this->session->remove('requesttoken');
 }
Esempio n. 7
0
 /**
  * Remove a $key/$value pair from the session
  *
  * @param string $key
  */
 public function remove($key)
 {
     $this->isModified = true;
     unset($this->sessionValues[$key]);
     $this->session->remove(self::encryptedSessionName);
 }
Esempio n. 8
0
 /**
  * Remove a $key/$value pair from the session
  *
  * @param string $key
  */
 public function remove($key)
 {
     $this->session->remove($key);
 }