PluginProbe
Loginizer / 2.0.9
Loginizer v2.0.9
2.1.0 2.0.9 2.0.8 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 trunk 1.0 1.0.1 1.0.2 1.1.0 1.1.1 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 All 74 releases
← All changes | init.php +26 -56 2.0.42.0.9 View file →
@@ -4,9 +4,9 @@
4 4 echo 'You are not allowed to access this page directly.';
5 5 exit;
6 6 }
7 7
8 -define('LOGINIZER_VERSION', '2.0.4');
8 +define('LOGINIZER_VERSION', '2.0.9');
9 9 define('LOGINIZER_DIR', dirname(LOGINIZER_FILE));
10 10 define('LOGINIZER_URL', plugins_url('', LOGINIZER_FILE));
11 11 define('LOGINIZER_PRO_URL', 'https://loginizer.com/features#compare');
12 12 define('LOGINIZER_PRICING_URL', 'https://loginizer.com/pricing');
@@ -332,21 +332,22 @@
332 332 // Is called before displaying the error message so that we dont show that the username is wrong or the password
333 333 // Update Error message
334 334 add_action('wp_login_errors', 'loginizer_error_handler', 10001, 2);
335 335 add_action('woocommerce_login_failed', 'loginizer_woocommerce_error_handler', 10001);
336 - add_action('wp_login', 'loginizer_login_success', 10, 2);
336 + add_action('wp_login', 'loginizer_login_success', 11, 2);
337 + add_action('rsssl_two_factor_user_authenticated', 'loginizer_rsssl_2fa_success');
337 338
338 339 if(!empty($loginizer['ultimate-member-active'])){
339 340 add_action('wp_login_failed', 'loginizer_ultimatemember_error_handler', 10001);
340 341 }
341 342
342 - if(!empty($_COOKIE['lz_social_error']) && !empty($loginizer['social_settings']) && !loginizer_is_blacklisted()){
343 + if(!empty($_COOKIE['lz_social_error']) && !empty($loginizer['social_settings'])){
343 344 add_filter('wp_login_errors', 'loginizer_social_login_error_handler', 10000, 2);
344 345 }
345 346 }
346 347
347 348 // Social Login Form Actions
348 - if(!empty($loginizer['social_settings']) && !loginizer_is_blacklisted()){
349 + if(!empty($loginizer['social_settings'])){
349 350 if(!empty($loginizer['social_settings']['login']['login_form'])){
350 351 add_action('login_form', 'loginizer_social_btn_login');
351 352 }
352 353 }
@@ -494,26 +495,31 @@
494 495
495 496 if(empty($blacklist)){
496 497 return false;
497 498 }
498 -
499 +
500 + $current_ip_inet = inet_ptoi($loginizer['current_ip']);
501 +
499 502 foreach($blacklist as $k => $v){
500 -
503 +
504 + $start_inet = inet_ptoi($v['start']);
505 + $end_inet = inet_ptoi($v['end']);
506 +
501 507 // Is the IP in the blacklist ?
502 - if(inet_ptoi($v['start']) <= inet_ptoi($loginizer['current_ip']) && inet_ptoi($loginizer['current_ip']) <= inet_ptoi($v['end'])){
508 + if($start_inet <= $current_ip_inet && $current_ip_inet <= $end_inet){
503 509 $result = 1;
504 510 break;
505 511 }
506 -
512 +
507 513 // Is it in a wider range ?
508 - if(inet_ptoi($v['start']) >= 0 && inet_ptoi($v['end']) < 0){
514 + if($start_inet >= 0 && $end_inet < 0){
509 515
510 516 // Since the end of the RANGE (i.e. current IP range) is beyond the +ve value of inet_ptoi,
511 517 // if the current IP is <= than the start of the range, it is within the range
512 518 // OR
513 519 // if the current IP is <= than the end of the range, it is within the range
514 - if(inet_ptoi($v['start']) <= inet_ptoi($loginizer['current_ip'])
515 - || inet_ptoi($loginizer['current_ip']) <= inet_ptoi($v['end'])){
520 + if($start_inet <= $current_ip_inet
521 + || $current_ip_inet <= $end_inet){
516 522 $result = 1;
517 523 break;
518 524 }
519 525
@@ -519,9 +525,9 @@
519 525
520 526 }
521 527
522 528 }
523 -
529 +
524 530 // You are blacklisted
525 531 if(!empty($result)){
526 532 $lz_error['ip_blacklisted'] = $loginizer['msg']['ip_blacklisted'];
527 533 return true;
@@ -530,52 +536,8 @@
530 536 return false;
531 537
532 538 }
533 539
534 -function loginizer_is_whitelisted(){
535 -
536 - global $wpdb, $loginizer, $lz_error;
537 -
538 - $whitelist = $loginizer['whitelist'];
539 -
540 - if(empty($whitelist)){
541 - return false;
542 - }
543 -
544 - foreach($whitelist as $k => $v){
545 -
546 - // Is the IP in the blacklist ?
547 - if(inet_ptoi($v['start']) <= inet_ptoi($loginizer['current_ip']) && inet_ptoi($loginizer['current_ip']) <= inet_ptoi($v['end'])){
548 - $result = 1;
549 - break;
550 - }
551 -
552 - // Is it in a wider range ?
553 - if(inet_ptoi($v['start']) >= 0 && inet_ptoi($v['end']) < 0){
554 -
555 - // Since the end of the RANGE (i.e. current IP range) is beyond the +ve value of inet_ptoi,
556 - // if the current IP is <= than the start of the range, it is within the range
557 - // OR
558 - // if the current IP is <= than the end of the range, it is within the range
559 - if(inet_ptoi($v['start']) <= inet_ptoi($loginizer['current_ip'])
560 - || inet_ptoi($loginizer['current_ip']) <= inet_ptoi($v['end'])){
561 - $result = 1;
562 - break;
563 - }
564 -
565 - }
566 -
567 - }
568 -
569 - // You are whitelisted
570 - if(!empty($result)){
571 - return true;
572 - }
573 -
574 - return false;
575 -
576 -}
577 -
578 540 // When the login fails, then this is called
579 541 // We need to update the database
580 542 function loginizer_login_failed($username, $is_2fa = ''){
581 543
@@ -675,8 +637,12 @@
675 637
676 638 }
677 639 }
678 640
641 +function loginizer_rsssl_2fa_success($user){
642 + loginizer_login_success('', $user);
643 +}
644 +
679 645 function loginizer_login_success($user_login, $user) {
680 646 global $wp_version, $loginizer;
681 647
682 648 loginizer_update_attempt_stats(1);
@@ -840,8 +806,12 @@
840 806
841 807 // Handles social login URL
842 808 function loginizer_social_login_error_handler($errors = '', $redirect_to = ''){
843 809 global $loginizer;
810 +
811 + if(loginizer_is_blacklisted()){
812 + return $errors;
813 + }
844 814
845 815 loginizer_get_social_error();
846 816
847 817 if(empty($loginizer['social_errors'])){