LoginLogoutAction.class.php (982B)
1 <?php 2 namespace cms\action\login; 3 use cms\action\Action; 4 use cms\action\LoginAction; 5 use cms\action\Method; 6 use cms\base\Configuration; 7 use language\Messages; 8 use util\Cookie; 9 use util\Request; 10 use util\Session; 11 12 13 class LoginLogoutAction extends LoginAction implements Method { 14 public function view() { 15 // There is no view for this action. 16 } 17 public function post() { 18 if ( Configuration::subset('security')->is('renew_session_logout',false) ) 19 $this->recreateSession(); 20 21 // Reading the login token cookie 22 list( $selector,$token ) = array_pad( explode('.',Cookie::get(Action::COOKIE_TOKEN)),2,''); 23 24 // Logout forces the removal of the login token for this device 25 if ( $selector ) 26 $this->currentUser->deleteLoginToken( $selector ); 27 28 // Cookie mit Logintoken löschen. 29 $this->setCookie(Action::COOKIE_TOKEN ); 30 31 Request::setUser(null); 32 33 $this->addNoticeFor( $this->currentUser, Messages::LOGOUT_OK ); 34 } 35 }