예제 #1
0
 /**
  * Checks for correct login credentials if necessary. If we don't have credentials and it is required, then we redirect to specified url
  */
 public function check_login($redirect_url = '')
 {
     // if login is not required, return true
     if (!$this->login_required) {
         return true;
     }
     // if login is required and we find good login credentials, return true
     if ($this->is_logged_in()) {
         return true;
     }
     // redirect to home
     if (empty($redirect_url)) {
         redirect::full($this->login_page_url);
     } else {
         redirect::full($redirect_url);
     }
 }