예제 #1
0
 public function checkRoleTypeAuthentication($type = 1)
 {
     // initialize the session (if not initialized yet)
     Session::init();
     // $this->checkSessionConcurrency();
     // if user is not logged in or the account type is not $type
     if (!Session::userIsLoggedIn() || Session::get(Session::SESSION_USER_ACCOUNT_TYPE) != $type) {
         // ... then treat user as "not logged in", destroy session, redirect to login page
         Session::destroy();
         $this->redirectHome();
         // to prevent fetching views via cURL (which "ignores" the header-redirect above) we leave the application
         // the hard way, via exit(). @see https://github.com/panique/php-login/issues/453
         // this is not optimal and will be fixed in future releases
         exit;
     }
 }
예제 #2
0
파일: Login.php 프로젝트: iubar/iubar-login
 /**
  * Log out process: delete cookie, delete session
  */
 public static function logout()
 {
     $user_name = Session::getDecoded(Session::SESSION_USER_NAME);
     $user_provider = Session::get(Session::SESSION_USER_PROVIDER_TYPE);
     if ($user_provider == UserModel::PROVIDER_TYPE_FB) {
         // Facebook
         // 			Session::set(Session::FACEBOOK_ID, null);
         // 			Session::set(Session::FACEBOOK_ACCESS_TOKEN, null);
         // 			Session::set(Session::FACEBOOK_DISPLAY_NAME, null);
         // 			Session::set(Session::FACEBOOK_PICTURE, null);
     } else {
         if ($user_provider == UserModel::PROVIDER_TYPE_GO) {
             // 			Session::set(Session::GOOGLE_ID, null);
             // 			Session::set(Session::GOOGLE_BEARER_TOKEN, null);
             // 			Session::set(Session::GOOGLE_DISPLAY_NAME, null);
             // 			Session::set(Session::GOOGLE_PICTURE, null);
         } else {
             self::deleteCookie($user_name);
             // solo per provider 'DEFAULT'
         }
     }
     Session::destroy();
     Session::updateSessionId($user_name, null);
     // 		if(false){ // Il seguente blocco è inutile (vedi statement successivi)
     // 			Session::set(Session::SESSION_FEEDBACK_NEGATIVE, null);
     // 			Session::set(Session::SESSION_FEEDBACK_POSITIVE, null);
     // 			Session::set(Session::SESSION_USER_NAME, null);
     // 			Session::set(Session::SESSION_USER_EMAIL, null);
     // 			Session::set(Session::SESSION_USER_ACCOUNT_TYPE, null);
     // 			Session::set(Session::SESSION_USER_PROVIDER_TYPE, null);
     // 			Session::set(Session::SESSION_USER_AVATAR_FILE, null);
     // 			Session::set(Session::SESSION_USER_GRAVATAR_IMAGE_URL, null);
     // 			Session::set(Session::SESSION_USER_LOGGED_IN, null);
     // 		}
     return true;
 }