Beispiel #1
0
 public function action_logout()
 {
     if (\CMF\Auth::logout()) {
         \Session::delete('cmf.admin.language');
         \Response::redirect('/admin/login', 'location');
     }
 }
Beispiel #2
0
 /**
  * Lock a user setting it's locked_at to actual time.
  *
  * @return bool
  */
 public function lock_access()
 {
     $this->locked_at = \Date::time('UTC')->format('mysql');
     if ($this->is_unlock_strategy_enabled('email')) {
         $this->generate_unlock_token();
     }
     // Revoke authentication token
     $this->authentication_token = null;
     // Save and make sure session is destroyed completely
     $em = \D::manager();
     $em->persist($this);
     $em->flush();
     if (Auth::logout(true)) {
         // Only send instructions after token was saved successfully
         if ($this->is_unlock_strategy_enabled('email')) {
             return $this->send_unlock_instructions();
         }
         return true;
     }
     return false;
 }