コード例 #1
0
ファイル: base.php プロジェクト: CDN-Sparks/owncloud
 protected static function tryFormLogin()
 {
     if (!isset($_POST["user"]) || !isset($_POST['password'])) {
         return false;
     }
     OC_App::loadApps();
     //setup extra user backends
     OC_User::setupBackends();
     if (OC_User::login($_POST["user"], $_POST["password"])) {
         // setting up the time zone
         if (isset($_POST['timezone-offset'])) {
             self::$session->set('timezone', $_POST['timezone-offset']);
         }
         $userid = OC_User::getUser();
         self::cleanupLoginTokens($userid);
         if (!empty($_POST["remember_login"])) {
             if (defined("DEBUG") && DEBUG) {
                 OC_Log::write('core', 'Setting remember login to cookie', OC_Log::DEBUG);
             }
             $token = OC_Util::generateRandomBytes(32);
             OC_Preferences::setValue($userid, 'login_token', $token, time());
             OC_User::setMagicInCookie($userid, $token);
         } else {
             OC_User::unsetMagicInCookie();
         }
         OC_Util::redirectToDefaultPage();
         exit;
     }
     return true;
 }
コード例 #2
0
ファイル: session.php プロジェクト: ninjasilicon/core
	/**
	 * logout the user from the session
	 */
	public function logout() {
		$this->manager->emit('\OC\User', 'logout');
		$this->setUser(null);
		$this->setLoginName(null);
		$this->unsetMagicInCookie();
		$this->session->clear();
	}
コード例 #3
0
ファイル: session.php プロジェクト: WYSAC/oregon-owncloud
 /**
  * will keep the session instance in sync with \OC::$session
  * @return \OC\Session\Session
  */
 private function getSession()
 {
     //keep $this->session in sync with \OC::$session
     if ($this->session !== \OC::$session) {
         \OC::$server->getLogger()->debug('\\OC::$session has been replaced with a new instance. ' . 'Closing and replacing session in UserSession instance.');
         $this->session->close();
         $this->session = \OC::$session;
     }
     return $this->session;
 }
コード例 #4
0
 /**
  * get the login name of the current user
  *
  * @return string
  */
 public function getLoginname()
 {
     if ($this->activeUser) {
         return $this->session->get('loginname');
     } else {
         $uid = $this->session->get('user_id');
         if ($uid) {
             $this->activeUser = $this->manager->get($uid);
             return $this->session->get('loginname');
         } else {
             return null;
         }
     }
 }
コード例 #5
0
ファイル: Internal.php プロジェクト: GitHubUser4234/core
 public function close()
 {
     session_write_close();
     parent::close();
 }
コード例 #6
0
ファイル: session.php プロジェクト: evanjt/core
 public function testNotExistsAfterClear()
 {
     $this->instance->set('foo', 1);
     $this->instance->clear();
     $this->assertFalse($this->instance->exists('foo'));
 }