Skip to content

Commit

Permalink
fixed a failure
Browse files Browse the repository at this point in the history
  • Loading branch information
REJack committed May 26, 2015
1 parent 86845c2 commit f0f1bb0
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions application/libraries/Aauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,18 +239,19 @@ public function login($identifier, $pass, $remember = FALSE, $totp_code = NULL)
if($this->config_vars['totp_active'] == TRUE){
$query = null;
$query = $this->aauth_db->where($db_identifier, $identifier);
$query = $this->aauth_db->where('totp_secret !=', '');
$query = $this->aauth_db->get($this->config_vars['users']);
$totp_secret = $query->row()->totp_secret;
if ($query->num_rows() > 0 AND !$totp_code) {
$this->error($this->CI->lang->line('aauth_error_totp_code_required'));
return FALSE;
}else if ($query->num_rows() > 0 AND $totp_code) {
$totp_secret = $query->row()->totp_secret;
$ga = new PHPGangsta_GoogleAuthenticator();
$checkResult = $ga->verifyCode($totp_secret, $totp_code, 0);
if (!$checkResult) {
$this->error($this->CI->lang->line('aauth_error_totp_code_invalid'));
return FALSE;
}else {
if(!empty($totp_secret)){
$ga = new PHPGangsta_GoogleAuthenticator();
$checkResult = $ga->verifyCode($totp_secret, $totp_code, 0);
if (!$checkResult) {
$this->error($this->CI->lang->line('aauth_error_totp_code_invalid'));
return FALSE;
}
}
}
}
Expand Down

0 comments on commit f0f1bb0

Please sign in to comment.