Example #1
0
 public function logout()
 {
     \Auth::logout();
     \Session::flush();
     //\Session::forget();
     sleep(1);
     \Auth::logout();
     if (\Auth::check()) {
         $user = \Auth::user();
         $user->last_active_time = time() - 3600;
         $user->updateStatus(0);
         $user->save();
     }
     return \Redirect::to('/');
 }
Example #2
0
 /**
  * Unlink account
  *
  * @param int $key Account session key
  */
 public static function unlink($key = 0)
 {
     // Revoke Token
     \Rest::get('https://accounts.google.com/o/oauth2/revoke', array('token' => $_SESSION['usernames'][$key]['credentials']['access_token']));
     // Remove Data
     UsersModel::remove($_SESSION['usernames'][$key]['username']['id']);
     if (isset($_SESSION['usernames'][$key])) {
         $toRemove = $_SESSION['usernames'][$key];
         unset($_SESSION['usernames'][$key]);
         if (isset($_SESSION['wizard']['source']) && $_SESSION['wizard']['source']['username']['id'] == $toRemove['username']['id']) {
             $_SESSION['wizard']['source'] = \Auth::userBeside($_SESSION['wizard']['destination']);
         }
         if (isset($_SESSION['wizard']['destination']) && $_SESSION['wizard']['destination']['username']['id'] == $toRemove['username']['id']) {
             $_SESSION['wizard']['destination'] = \Auth::userBeside($_SESSION['sync']['source']);
         }
         if ($_SESSION['current']['username']['id'] == $key && count($_SESSION['usernames'])) {
             end($_SESSION['usernames']);
             $_SESSION['current'] = current($_SESSION['usernames']);
         }
     }
     if (!count($_SESSION['usernames'])) {
         \Auth::logout();
     }
     \Util::notice(array('type' => 'success', 'text' => 'The account has been successfully removed and its API tokens revoked.'));
     \Router::redirect('accounts');
 }
 /**
  * @return \Illuminate\Http\RedirectResponse
  */
 public function getLogout()
 {
     \Auth::logout();
     return \Redirect::action('home.index');
 }