Browse Source

added totp_reset_over_reset_password and update_user_totp_secret()

develop
Raphael Jackstadt 10 years ago
parent
commit
11288205fa
  1. 2
      application/config/aauth.php
  2. 17
      application/libraries/Aauth.php

2
application/config/aauth.php

@ -58,6 +58,8 @@ $config['aauth']['recaptcha_siteKey'] = '';
$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;

17
application/libraries/Aauth.php

@ -502,6 +502,10 @@ class Aauth {
'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;
@ -2131,7 +2135,18 @@ class Aauth {
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) {

Loading…
Cancel
Save