Skip to content

Commit

Permalink
fixed login error after TOTP check (login with wrong pw fixed)
Browse files Browse the repository at this point in the history
  • Loading branch information
REJack committed Jun 25, 2015
1 parent 3413b3b commit 461278b
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions application/libraries/Aauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,7 @@ public function login($identifier, $pass, $remember = FALSE, $totp_code = NULL)
}

$user_id = $query->row()->id;

$query = null;
$query = $this->aauth_db->where($db_identifier, $identifier);

// Database stores pasword hashed password
$query = $this->aauth_db->where('pass', $this->hash_password($pass, $user_id));
$query = $this->aauth_db->where('banned', 0);

$query = $this->aauth_db->get($this->config_vars['users']);

$row = $query->row();
if( ($this->config_vars['use_cookies'] == TRUE && $this->CI->input->cookie('reCAPTCHA', TRUE) == 'true') || ($this->config_vars['use_cookies'] == FALSE && $this->CI->session->tempdata('reCAPTCHA') == 'true') ){
$reCaptcha = new ReCaptcha( $this->config_vars['recaptcha_secret']);
$resp = $reCaptcha->verifyResponse( $this->CI->input->server("REMOTE_ADDR"), $this->CI->input->post("g-recaptcha-response") );
Expand Down Expand Up @@ -286,9 +276,20 @@ public function login($identifier, $pass, $remember = FALSE, $totp_code = NULL)
}
}
}


$query = null;
$query = $this->aauth_db->where($db_identifier, $identifier);

// Database stores pasword hashed password
$query = $this->aauth_db->where('pass', $this->hash_password($pass, $user_id));
$query = $this->aauth_db->where('banned', 0);

$query = $this->aauth_db->get($this->config_vars['users']);

$row = $query->row();

// if email and pass matches and not banned
if ( $query->num_rows() > 0 ) {
if ( $query->num_rows() != 0 ) {

// If email and pass matches
// create session
Expand Down Expand Up @@ -474,7 +475,7 @@ public function logout() {
);
$this->CI->input->set_cookie($cookie);
}

return $this->CI->session->sess_destroy();
}

Expand Down

0 comments on commit 461278b

Please sign in to comment.