Frontend\Modules\Profiles\Engine\Authentication::logout PHP Метод

logout() публичный статический Метод

Logout a profile.
public static logout ( )
    public static function logout()
    {
        // delete session records
        FrontendModel::getContainer()->get('database')->delete('profiles_sessions', 'session_id = ?', array(\SpoonSession::getSessionId()));
        // set is_logged_in to false
        \SpoonSession::set('frontend_profile_logged_in', false);
        // delete cookie
        CommonCookie::delete('frontend_profile_secret_key');
    }

Usage Example

Пример #1
0
 /**
  * Execute the extra.
  */
 public function execute()
 {
     // logout
     if (FrontendProfilesAuthentication::isLoggedIn()) {
         FrontendProfilesAuthentication::logout();
     }
     // trigger event
     FrontendModel::triggerEvent('Profiles', 'after_logout');
     // redirect
     $this->redirect(SITE_URL);
 }