Exemplo n.º 1
0
 /**
  * Check the user is authenticated
  * @return boolean
  */
 protected function checkAuthenticated()
 {
     // Create user
     if (!$this->user) {
         $this->user = new \Sonic\Model\User();
     }
     // Check authenticated
     $auth = $this->user->initSession();
     if ($auth !== TRUE) {
         switch ($auth) {
             case 'invalid_session':
                 new Message('error', 'Please login to continue');
                 break;
             case 'user_read_error':
                 new Message('error', 'There seems to be a problem, please login to continue');
                 break;
             case 'inactive':
                 new Message('error', 'Account not activated');
                 break;
             case 'timeout':
                 new Message('error', 'Your session has expired, please login to continue');
                 break;
         }
         $this->template = $this->authModule ? strtolower($this->authModule) . '/' : NULL;
         $this->template .= 'login.tpl';
         return FALSE;
     }
     // Return
     return TRUE;
 }
Exemplo n.º 2
0
 /**
  * Check the user is authenticated
  * @param string $session_id Session ID
  * @return boolean
  */
 protected function checkAuthenticated($session_id = FALSE)
 {
     // Create user
     if (!$this->user) {
         $this->user = new \Sonic\Model\User($session_id);
     }
     // Check authenticated
     $auth = $this->user->initSession();
     if ($auth !== TRUE) {
         return $this->authFail($auth);
     }
     // Return
     return TRUE;
 }