From 9aca808dd70885e0d6c293189f015774cf031cf6 Mon Sep 17 00:00:00 2001 From: REJack Date: Tue, 6 Oct 2015 15:51:00 +0200 Subject: [PATCH 1/2] possible fix for #66 --- application/libraries/Aauth.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/application/libraries/Aauth.php b/application/libraries/Aauth.php index 0a30bb2..a247bd0 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -221,14 +221,15 @@ class Aauth { } $user_id = $query->row()->id; + if($this->config_vars['recaptcha_active']){ + 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") ); - 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") ); - - if(!$resp->success){ - $this->error($this->CI->lang->line('aauth_error_recaptcha_not_correct')); - return FALSE; + if(!$resp->success){ + $this->error($this->CI->lang->line('aauth_error_recaptcha_not_correct')); + return FALSE; + } } } From e6aa1f6a057fedf441e665fb4251929327f0c4cc Mon Sep 17 00:00:00 2001 From: REJack Date: Tue, 6 Oct 2015 21:32:45 +0200 Subject: [PATCH 2/2] changed __key__ to __data_key__ in ``user_variables`` & ``system_variables`` (fix for #68) --- application/libraries/Aauth.php | 24 ++++++++++++------------ sql/Aauth_v2.sql | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/application/libraries/Aauth.php b/application/libraries/Aauth.php index a247bd0..eb08a3f 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -2025,7 +2025,7 @@ class Aauth { if ($this->get_user_var($key,$user_id) ===FALSE) { $data = array( - 'key' => $key, + 'data_key' => $key, 'value' => $value, 'user_id' => $user_id ); @@ -2036,12 +2036,12 @@ class Aauth { else { $data = array( - 'key' => $key, + 'data_key' => $key, 'value' => $value, 'user_id' => $user_id ); - $this->aauth_db->where( 'key', $key ); + $this->aauth_db->where( 'data_key', $key ); $this->aauth_db->where( 'user_id', $user_id); return $this->aauth_db->update( $this->config_vars['user_variables'], $data); @@ -2066,7 +2066,7 @@ class Aauth { return FALSE; } - $this->aauth_db->where('key', $key); + $this->aauth_db->where('data_key', $key); $this->aauth_db->where('user_id', $user_id); return $this->aauth_db->delete( $this->config_vars['user_variables'] ); @@ -2092,7 +2092,7 @@ class Aauth { } $query = $this->aauth_db->where('user_id', $user_id); - $query = $this->aauth_db->where('key', $key); + $query = $this->aauth_db->where('data_key', $key); $query = $this->aauth_db->get( $this->config_vars['user_variables'] ); @@ -2124,7 +2124,7 @@ class Aauth { if ( ! $this->get_user($user_id)){ return FALSE; } - $query = $this->aauth_db->select('key'); + $query = $this->aauth_db->select('data_key'); $query = $this->aauth_db->where('user_id', $user_id); @@ -2156,7 +2156,7 @@ class Aauth { if ($this->get_system_var($key) === FALSE) { $data = array( - 'key' => $key, + 'data_key' => $key, 'value' => $value, ); @@ -2167,11 +2167,11 @@ class Aauth { else { $data = array( - 'key' => $key, + 'data_key' => $key, 'value' => $value, ); - $this->aauth_db->where( 'key', $key ); + $this->aauth_db->where( 'data_key', $key ); return $this->aauth_db->update( $this->config_vars['system_variables'], $data); } @@ -2185,7 +2185,7 @@ class Aauth { */ public function unset_system_var( $key ) { - $this->aauth_db->where('key', $key); + $this->aauth_db->where('data_key', $key); return $this->aauth_db->delete( $this->config_vars['system_variables'] ); } @@ -2199,7 +2199,7 @@ class Aauth { */ public function get_system_var( $key ){ - $query = $this->aauth_db->where('key', $key); + $query = $this->aauth_db->where('data_key', $key); $query = $this->aauth_db->get( $this->config_vars['system_variables'] ); @@ -2220,7 +2220,7 @@ class Aauth { */ public function list_system_var_keys(){ - $query = $this->aauth_db->select('key'); + $query = $this->aauth_db->select('data_key'); $query = $this->aauth_db->get( $this->config_vars['system_variables'] ); // if variable not set if ($query->num_rows() < 1) { return FALSE;} diff --git a/sql/Aauth_v2.sql b/sql/Aauth_v2.sql index 7696cb9..e5f20d3 100644 --- a/sql/Aauth_v2.sql +++ b/sql/Aauth_v2.sql @@ -91,7 +91,7 @@ CREATE TABLE `aauth_pms` ( DROP TABLE IF EXISTS `aauth_system_variables`; CREATE TABLE `aauth_system_variables` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `key` varchar(100) NOT NULL, + `data_key` varchar(100) NOT NULL, `value` text, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -151,7 +151,7 @@ DROP TABLE IF EXISTS `aauth_user_variables`; CREATE TABLE `aauth_user_variables` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(11) unsigned NOT NULL, - `key` varchar(100) NOT NULL, + `data_key` varchar(100) NOT NULL, `value` text, PRIMARY KEY (`id`), KEY `user_id_index` (`user_id`)