Skip to content

Commit

Permalink
added totp_reset_over_reset_password and update_user_totp_secret()
Browse files Browse the repository at this point in the history
  • Loading branch information
REJack committed May 26, 2015
1 parent 98f0a74 commit 1128820
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions application/config/aauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
$config['aauth']['recaptcha_secret'] = '';

$config['aauth']['totp_active'] = true;
$config['aauth']['totp_reset_over_reset_password'] = false;

// login attempts time interval
// default 20 times in one hour
$config['aauth']['max_login_attempt'] = 10;
Expand Down
17 changes: 16 additions & 1 deletion application/libraries/Aauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,10 @@ public function reset_password($user_id, $ver_code){
'pass' => $this->hash_password($pass, $user_id)
);

if($this->config_vars['totp_active'] == TRUE AND $this->config_vars['totp_reset_over_reset_password'] == TRUE){
$data['totp_secret'] = NULL;
}

$row = $query->row();
$email = $row->email;

Expand Down Expand Up @@ -2131,7 +2135,18 @@ public function generate_recaptcha_field(){
return $content;
}

public function generate_totp_secret(){
public function update_user_totp_secret($user_id = FALSE, $secret) {

if ($user_id == FALSE)
$user_id = $this->CI->session->userdata('id');

$data['totp_secret'] = $secret;

$this->aauth_db->where('id', $user_id);
return $this->aauth_db->update($this->config_vars['users'], $data);
}

public function generate_unique_totp_secret(){
$ga = new PHPGangsta_GoogleAuthenticator();
$stop = false;
while (!$stop) {
Expand Down

0 comments on commit 1128820

Please sign in to comment.