Changeset 253
- Timestamp:
- 05/27/07 17:22:26
- Files:
-
- FreakAuth/trunk/www/system/application/config/freakauth_light.php (modified) (6 diffs)
- FreakAuth/trunk/www/system/application/libraries/FAL_front.php (modified) (6 diffs)
- FreakAuth/trunk/www/system/application/libraries/FAL_validation.php (modified) (1 diff)
- FreakAuth/trunk/www/system/application/libraries/Freakauth_light.php (modified) (8 diffs)
- FreakAuth/trunk/www/system/application/views/FreakAuth_light/content/forgotten_password.php (modified) (1 diff)
- FreakAuth/trunk/www/system/application/views/FreakAuth_light/content/login.php (modified) (1 diff)
- FreakAuth/trunk/www/system/application/views/FreakAuth_light/content/register.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
FreakAuth/trunk/www/system/application/config/freakauth_light.php
r252 r253 139 139 |------------------------------------------------------------------------------ 140 140 */ 141 $config['FAL_use_ security_code_login'] = TRUE;142 $config['FAL_use_ security_code_register'] = TRUE;143 $config['FAL_use_ security_code_forgot_password'] = TRUE;141 $config['FAL_use_captcha_login'] = TRUE; 142 $config['FAL_use_captcha_register'] = TRUE; 143 $config['FAL_use_captcha_forgot_password'] = TRUE; 144 144 145 145 /* … … 192 192 |------------------------------------------------------------------------------- 193 193 */ 194 $config['FAL_ security_code_case_sensitive'] = TRUE;194 $config['FAL_captcha_case_sensitive'] = TRUE; 195 195 196 196 /* … … 200 200 */ 201 201 // upper and lower case (lower case by default) 202 $config['FAL_ security_code_upper_lower_case'] = FALSE;203 $config['FAL_ security_code_use_numbers'] = FALSE;202 $config['FAL_captcha_upper_lower_case'] = FALSE; 203 $config['FAL_captcha_use_numbers'] = FALSE; 204 204 205 205 // use special characters (if true, use a font that support it) 206 $config['FAL_ security_code_use_specials'] = FALSE;207 208 $config['FAL_ security_code_min'] = 5; //min captcha length209 $config['FAL_ security_code_max'] = 5; //max captcha length206 $config['FAL_captcha_use_specials'] = FALSE; 207 208 $config['FAL_captcha_min'] = 5; //min captcha length 209 $config['FAL_captcha_max'] = 5; //max captcha length 210 210 211 211 /* … … 214 214 |------------------------------------------------------------------------------- 215 215 */ 216 $config['FAL_ security_code_image_font_size'] = 20;217 $config['FAL_ security_code_image_font_color'] = '33CC33';216 $config['FAL_captcha_image_font_size'] = 20; 217 $config['FAL_captcha_image_font_color'] = '33CC33'; 218 218 219 219 /* … … 222 222 |------------------------------------------------------------------------------- 223 223 */ 224 $config['FAL_ security_image_library'] = 'GD2';224 $config['FAL_captcha_image_library'] = 'GD2'; 225 225 226 226 // Folder of the Base image needed to generate Captcha 227 $config['FAL_ security_code_base_image_path'] = 'public/images/captcha/';227 $config['FAL_captcha_base_image_path'] = 'public/images/captcha/'; 228 228 229 229 // Base image name for captcha 230 $config['FAL_ security_code_image_base_image'] = 'base_image.jpg';230 $config['FAL_captcha_image_base_image'] = 'base_image.jpg'; 231 231 232 232 // captcha font location 233 $config['FAL_ security_code_image_font'] = BASEPATH.'fonts/Jester.ttf';233 $config['FAL_captcha_image_font'] = BASEPATH.'fonts/Jester.ttf'; 234 234 235 235 // Folder to save the captcha background image (relative BASEPATH) 236 236 // this folder must be writable by php 237 $config['FAL_ security_code_image_path'] = 'tmp/';237 $config['FAL_captcha_image_path'] = 'tmp/'; 238 238 239 239 //name of the generate image (leave it blank!!!!!!) 240 $config['FAL_ security_code_image'] = '';240 $config['FAL_captcha_image'] = ''; 241 241 242 242 /* … … 281 281 282 282 // SECURITTY CODE 283 $config['FAL_user_ security_code_field_validation'] = 'trim|required|xss_clean|securitycode_check';283 $config['FAL_user_captcha_field_validation'] = 'trim|required|xss_clean|securitycode_check'; 284 284 285 285 // FORGOTTEN PASSWORD FreakAuth/trunk/www/system/application/libraries/FAL_front.php
r246 r253 124 124 125 125 //do we want chaptcha for login? 126 if ($this->CI->config->item('FAL_use_ security_code_login'))126 if ($this->CI->config->item('FAL_use_captcha_login')) 127 127 { 128 128 $fields['security'] = $this->CI->lang->line('FAL_captcha_label'); 129 $rules['security'] = $this->CI->config->item('FAL_user_ security_code_field_validation');129 $rules['security'] = $this->CI->config->item('FAL_user_captcha_field_validation'); 130 130 } 131 131 … … 174 174 { 175 175 176 if ($this->CI->config->item('FAL_use_ security_code_login'))176 if ($this->CI->config->item('FAL_use_captcha_login')) 177 177 { 178 178 $action='_login'; 179 179 $this->CI->freakauth_light->captcha_init($action); 180 $data['captcha'] = $this->CI->config->item('FAL_ security_code_image');180 $data['captcha'] = $this->CI->config->item('FAL_captcha_image'); 181 181 } 182 182 … … 250 250 } 251 251 //do we also want to secure the registration with CAPTCHA? 252 if ($this->CI->config->item('FAL_use_ security_code_register'))252 if ($this->CI->config->item('FAL_use_captcha_register')) 253 253 { 254 254 $fields['security'] = $this->CI->lang->line('FAL_captcha_label'); 255 $rules['security'] = $this->CI->config->item('FAL_user_ security_code_field_validation');255 $rules['security'] = $this->CI->config->item('FAL_user_captcha_field_validation'); 256 256 } 257 257 … … 281 281 } 282 282 //if we want to secure the registration with CAPTCHA let's generate it 283 if ($this->CI->config->item('FAL_use_ security_code_register'))283 if ($this->CI->config->item('FAL_use_captcha_register')) 284 284 { 285 285 $action='_register'; 286 286 $this->CI->freakauth_light->captcha_init($action); 287 $data['captcha'] = $this->CI->config->item('FAL_ security_code_image');287 $data['captcha'] = $this->CI->config->item('FAL_captcha_image'); 288 288 } 289 289 … … 366 366 367 367 //do we also want CAPTCHA? 368 if ($this->CI->config->item('FAL_use_ security_code_forgot_password'))368 if ($this->CI->config->item('FAL_use_captcha_forgot_password')) 369 369 { 370 370 $fields['security'] = $this->CI->lang->line('FAL_captcha_label'); 371 $rules['security'] = $this->CI->config->item('FAL_user_ security_code_field_validation');371 $rules['security'] = $this->CI->config->item('FAL_user_captcha_field_validation'); 372 372 } 373 373 … … 391 391 392 392 //do we want captcha 393 if ($this->CI->config->item('FAL_use_ security_code_forgot_password'))393 if ($this->CI->config->item('FAL_use_captcha_forgot_password')) 394 394 { 395 395 $action='_forgot_password'; 396 396 $this->CI->freakauth_light->captcha_init($action); 397 $data['captcha'] = $this->CI->config->item('FAL_ security_code_image');397 $data['captcha'] = $this->CI->config->item('FAL_captcha_image'); 398 398 } 399 399 FreakAuth/trunk/www/system/application/libraries/FAL_validation.php
r239 r253 363 363 function securitycode_check($value) 364 364 { 365 if ($this->CI->config->item('FAL_use_ security_code_register') OR $this->CI->config->item('FAL_use_security_code_login') OR $this->CI->config->item('FAL_use_security_code_forgot_password'))365 if ($this->CI->config->item('FAL_use_captcha_register') OR $this->CI->config->item('FAL_use_captcha_login') OR $this->CI->config->item('FAL_use_captcha_forgot_password')) 366 366 { 367 367 //gets the security code stored in the db_session 368 $securityCode = $this->CI->db_session->userdata('FreakAuth_ security_code');368 $securityCode = $this->CI->db_session->userdata('FreakAuth_captcha'); 369 369 370 370 // erase the code from the session to prevent it to be used a second time 371 371 // see http://www.ciforge.com/trac/freakauth/ticket/20 372 $this->CI->db_session->unset_userdata('FreakAuth_ security_code');372 $this->CI->db_session->unset_userdata('FreakAuth_captcha'); 373 373 374 if ($this->CI->config->item('FAL_ security_code_case_sensitive')==FALSE)374 if ($this->CI->config->item('FAL_captcha_case_sensitive')==FALSE) 375 375 { 376 376 $control= strcmp(strtolower($value), strtolower($securityCode)); FreakAuth/trunk/www/system/application/libraries/Freakauth_light.php
r249 r253 903 903 { 904 904 //checks FreakAuth security code configuration 905 if (!$this->CI->config->item('FAL_use_ security_code'.$action))905 if (!$this->CI->config->item('FAL_use_captcha'.$action)) 906 906 907 907 //if not set or FALSE … … 909 909 910 910 //ELSE unsets userdata from session table 911 $this->CI->db_session->unset_userdata('FreakAuth_ security_code');911 $this->CI->db_session->unset_userdata('FreakAuth_captcha'); 912 912 913 913 //loads the captcha plugin … … 932 932 function show_captcha() { 933 933 $img_html = '<span class="note">'; 934 $img_html.= '<img src="'.base_url().$this->CI->config->item('FAL_ security_code_image_path').$this->CI->config->item('FAL_security_code_image').'" alt="" />';934 $img_html.= '<img src="'.base_url().$this->CI->config->item('FAL_captcha_image_path').$this->CI->config->item('FAL_captcha_image').'" alt="" />'; 935 935 $img_html.= '</span>'; 936 936 return $img_html; … … 954 954 $expiration=60*10; //10 min 955 955 956 $current_dir = @opendir($this->CI->config->item('FAL_ security_code_image_path'));956 $current_dir = @opendir($this->CI->config->item('FAL_captcha_image_path')); 957 957 958 958 while($filename = @readdir($current_dir)) … … 964 964 if (($name + $expiration) < $now) 965 965 { 966 @unlink($this->CI->config->item('FAL_ security_code_image_path').$filename);966 @unlink($this->CI->config->item('FAL_captcha_image_path').$filename); 967 967 } 968 968 } … … 982 982 { 983 983 984 $securityCode = $this->_generateRandomString($this->CI->config->item('FAL_ security_code_min'), $this->CI->config->item('FAL_security_code_max'));984 $securityCode = $this->_generateRandomString($this->CI->config->item('FAL_captcha_min'), $this->CI->config->item('FAL_captcha_max')); 985 985 //$image = 'security-'.$this->_generateRandomString(16, 32).'.jpg'; 986 986 $image = $now.'.jpg'; 987 $this->CI->config->set_item('FAL_ security_code_image', $image);988 989 $config['image_library'] = $this->CI->config->item('FAL_ security_image_library');990 $config['source_image'] = $this->CI->config->item('FAL_ security_code_base_image_path').$this->CI->config->item('FAL_security_code_image_base_image');991 $config['new_image'] = $this->CI->config->item('FAL_ security_code_image_path').$image;987 $this->CI->config->set_item('FAL_captcha_image', $image); 988 989 $config['image_library'] = $this->CI->config->item('FAL_captcha_image_library'); 990 $config['source_image'] = $this->CI->config->item('FAL_captcha_base_image_path').$this->CI->config->item('FAL_captcha_image_base_image'); 991 $config['new_image'] = $this->CI->config->item('FAL_captcha_image_path').$image; 992 992 $config['wm_text'] = $securityCode; 993 993 $config['wm_type'] = 'text'; 994 $config['wm_font_path'] = $this->CI->config->item('FAL_ security_code_image_font');995 $config['wm_font_size'] = $this->CI->config->item('FAL_ security_code_image_font_size');996 $config['wm_font_color'] = $this->CI->config->item('FAL_ security_code_image_font_color');994 $config['wm_font_path'] = $this->CI->config->item('FAL_captcha_image_font'); 995 $config['wm_font_size'] = $this->CI->config->item('FAL_captcha_image_font_size'); 996 $config['wm_font_color'] = $this->CI->config->item('FAL_captcha_image_font_color'); 997 997 $config['wm_vrt_alignment'] = 'top'; 998 998 $config['wm_hor_alignment'] = 'left'; … … 1008 1008 }; 1009 1009 1010 $this->CI->db_session->set_userdata('FreakAuth_ security_code', $securityCode);1011 return $this->CI->config->item('FAL_ security_code_image');1010 $this->CI->db_session->set_userdata('FreakAuth_captcha', $securityCode); 1011 return $this->CI->config->item('FAL_captcha_image'); 1012 1012 1013 1013 … … 1029 1029 { 1030 1030 $charset = "abcdefghijklmnopqrstuvwxyz"; 1031 if ($this->CI->config->item('FAL_ security_code_upper_lower_case'))1031 if ($this->CI->config->item('FAL_captcha_upper_lower_case')) 1032 1032 $charset .= "ABCDEFGHIJKLMNPQRSTUVWXYZ"; 1033 if ($this->CI->config->item('FAL_ security_code_use_numbers'))1033 if ($this->CI->config->item('FAL_captcha_use_numbers')) 1034 1034 $charset .= "23456789"; 1035 if ($this->CI->config->item('FAL_ security_code_use_specials'))1035 if ($this->CI->config->item('FAL_captcha_use_specials')) 1036 1036 $charset .= "~@#$%^*()_+-={}|]["; 1037 1037 1038 $length = mt_rand($this->CI->config->item('FAL_ security_code_min'), $this->CI->config->item('FAL_security_code_max'));1039 if ($this->CI->config->item('FAL_ security_code_min') > $this->CI->config->item('FAL_security_code_max'))1040 $length = mt_rand($this->CI->config->item('FAL_ security_code_max'), $this->CI->config->item('FAL_security_code_min'));1038 $length = mt_rand($this->CI->config->item('FAL_captcha_min'), $this->CI->config->item('FAL_captcha_max')); 1039 if ($this->CI->config->item('FAL_captcha_min') > $this->CI->config->item('FAL_captcha_max')) 1040 $length = mt_rand($this->CI->config->item('FAL_captcha_max'), $this->CI->config->item('FAL_captcha_min')); 1041 1041 1042 1042 $key = ''; FreakAuth/trunk/www/system/application/views/FreakAuth_light/content/forgotten_password.php
r213 r253 11 11 <!--CAPTCHA (security image)--> 12 12 <?php 13 if ($this->config->item('FAL_use_ security_code_forgot_password'))13 if ($this->config->item('FAL_use_captcha_forgot_password')) 14 14 {?> 15 15 <p><label for="security"><?=$this->lang->line('FAL_captcha_label')?>:</label> FreakAuth/trunk/www/system/application/views/FreakAuth_light/content/login.php
r213 r253 23 23 <!--CAPTCHA (security image)--> 24 24 <?php 25 if ($this->config->item('FAL_use_ security_code_login'))25 if ($this->config->item('FAL_use_captcha_login')) 26 26 {?> 27 27 <p><label for="security"><?=$this->lang->line('FAL_captcha_label')?>:</label> FreakAuth/trunk/www/system/application/views/FreakAuth_light/content/register.php
r213 r253 41 41 <!--CAPTCHA (security image)--> 42 42 <?php 43 if ($this->config->item('FAL_use_ security_code_register'))43 if ($this->config->item('FAL_use_captcha_register')) 44 44 {?> 45 45 <p><label for="security"><?=$this->lang->line('FAL_captcha_label')?>:</label>
