Browse Source

fixed a failure

develop
Raphael Jackstadt 10 years ago
parent
commit
f0f1bb08e8
  1. 17
      application/libraries/Aauth.php

17
application/libraries/Aauth.php

@ -239,18 +239,19 @@ class Aauth {
if($this->config_vars['totp_active'] == TRUE){ if($this->config_vars['totp_active'] == TRUE){
$query = null; $query = null;
$query = $this->aauth_db->where($db_identifier, $identifier); $query = $this->aauth_db->where($db_identifier, $identifier);
$query = $this->aauth_db->where('totp_secret !=', '');
$query = $this->aauth_db->get($this->config_vars['users']); $query = $this->aauth_db->get($this->config_vars['users']);
$totp_secret = $query->row()->totp_secret;
if ($query->num_rows() > 0 AND !$totp_code) { if ($query->num_rows() > 0 AND !$totp_code) {
$this->error($this->CI->lang->line('aauth_error_totp_code_required')); $this->error($this->CI->lang->line('aauth_error_totp_code_required'));
return FALSE; return FALSE;
}else if ($query->num_rows() > 0 AND $totp_code) { }else {
$totp_secret = $query->row()->totp_secret; if(!empty($totp_secret)){
$ga = new PHPGangsta_GoogleAuthenticator(); $ga = new PHPGangsta_GoogleAuthenticator();
$checkResult = $ga->verifyCode($totp_secret, $totp_code, 0); $checkResult = $ga->verifyCode($totp_secret, $totp_code, 0);
if (!$checkResult) { if (!$checkResult) {
$this->error($this->CI->lang->line('aauth_error_totp_code_invalid')); $this->error($this->CI->lang->line('aauth_error_totp_code_invalid'));
return FALSE; return FALSE;
}
} }
} }
} }

Loading…
Cancel
Save