Browse Source

some little fixes

`is_loggedin()` 2 empty lines removed
`control()` it hasn't checked if no perm_par was given
develop
REJack 9 years ago
parent
commit
bf0463310e
  1. 29
      application/libraries/Aauth.php

29
application/libraries/Aauth.php

@ -362,11 +362,9 @@ class Aauth {
*/ */
public function is_loggedin() { public function is_loggedin() {
if ( $this->CI->session->userdata('loggedin') ) if ( $this->CI->session->userdata('loggedin') ){
{ return TRUE; } return TRUE;
} else {
// cookie control
else {
if($this->config_vars['use_cookies'] == TRUE){ if($this->config_vars['use_cookies'] == TRUE){
if( ! $this->CI->input->cookie('user', TRUE) ){ if( ! $this->CI->input->cookie('user', TRUE) ){
return FALSE; return FALSE;
@ -445,12 +443,27 @@ class Aauth {
$perm_id = $this->get_perm_id($perm_par); $perm_id = $this->get_perm_id($perm_par);
$this->update_activity(); $this->update_activity();
if($perm_par == FALSE){
if($this->is_loggedin()){
if($this->CI->session->userdata('totp_required')){
$this->error($this->CI->lang->line('aauth_error_no_access'));
redirect($this->config_vars['totp_two_step_login_redirect']);
}else{
return TRUE;
}
}else if(!$this->is_loggedin()){
$this->error($this->CI->lang->line('aauth_error_no_access'));
if($this->config_vars['no_permission'] !== FALSE){
redirect($this->config_vars['no_permission']);
}
}
// if user or user's group not allowed }else if ( ! $this->is_allowed($perm_id) OR ! $this->is_group_allowed($perm_id) ){
if ( ! $this->is_allowed($perm_id) OR ! $this->is_group_allowed($perm_id) ){
if( $this->config_vars['no_permission'] ) { if( $this->config_vars['no_permission'] ) {
$this->error($this->CI->lang->line('aauth_error_no_access')); $this->error($this->CI->lang->line('aauth_error_no_access'));
redirect($this->config_vars['no_permission']); if($this->config_vars['no_permission'] !== FALSE){
redirect($this->config_vars['no_permission']);
}
} }
else { else {
echo $this->CI->lang->line('aauth_error_no_access'); echo $this->CI->lang->line('aauth_error_no_access');

Loading…
Cancel
Save