Plugin Directory

Changeset 2647464


Ignore:
Timestamp:
12/21/2021 05:02:32 PM (4 years ago)
Author:
avi.megladon
Message:

bug fixes

Location:
login-sidebar-widget
Files:
110 added
6 edited

Legend:

Unmodified
Added
Removed
  • login-sidebar-widget/trunk/css/style_login_widget.css

    r2445022 r2647464  
    11.error_wid_login {
    2     background-color: #ffffd2;
    3     border: 1px solid #e6db55;
    4     border-radius: 2px;
    5     color: #000;
    6     font-weight: 500;
    7     padding: 6px 14px 6px 6px;
    8     position: relative;
    9     width: 100%;
     2  background-color: #ffffd2;
     3  border: 1px solid #e6db55;
     4  border-radius: 2px;
     5  color: #000;
     6  font-weight: 500;
     7  padding: 6px 14px 6px 6px;
     8  position: relative;
     9  width: 100%;
     10  border-radius: 5px;
    1011}
    1112.success_wid_login {
    12     background-color: #FFFFD2;
    13     border: 1px dashed #E6DB55;
    14     color: #000;
    15     border-radius: 2px;
    16     font-weight: 500;
    17     padding: 6px 14px 6px 6px;
    18     width: 100%;
     13  background-color: #ffffd2;
     14  border: 1px dashed #e6db55;
     15  color: #000;
     16  border-radius: 2px;
     17  font-weight: 500;
     18  padding: 6px 14px 6px 6px;
     19  width: 100%;
     20  border-radius: 5px;
    1921}
    2022.close_button_ap {
    21     text-decoration: none !important;
    22     border: none !important;
    23     color: #000;
    24     position: absolute;
    25     top: 2px;
    26     right: 1px;
    27     width:16px;
    28     height:16px;
    29     background-image: url("../images/close.png");
    30     cursor:pointer;
     23  text-decoration: none !important;
     24  border: none !important;
     25  color: #000;
     26  position: absolute;
     27  top: 2px;
     28  right: 1px;
     29  width: 16px;
     30  height: 16px;
     31  background-image: url("../images/close.png");
     32  cursor: pointer;
    3133}
    3234.captcha {
    33     margin:0px 0px 10px 0px;
     35  margin: 0px 0px 10px 0px;
    3436}
    3537.forgot-pass-form-group {
    36     margin: 10px;
     38  margin: 10px;
    3739}
    3840.forgot-pass-form-group label {
    39     width: 100%;
     41  width: 100%;
    4042}
    4143.forgot-pass-form-group input[type="email"] {
    42     width: 100%;
     44  width: 100%;
    4345}
    4446label.error {
    45     margin: 0;
    46     padding: 0;
    47     color: #ff0000;
    48     font-weight:400;
     47  margin: 0;
     48  padding: 0;
     49  color: #ff0000;
     50  font-weight: 400;
    4951}
    5052input.error {
    51     border: 1px solid #ff0000 !important;
     53  border: 1px solid #ff0000 !important;
    5254}
    53 .lw-error{
    54     color: #ff0000;
     55
     56/* form */
     57
     58.login-wrap {
     59  max-width: 400px;
     60  width: 100%;
     61  border: 2px solid #f1f1f1;
     62  background-color: #fff;
     63  padding: 15px;
     64  border-radius: 5px;
     65  font-family: sans-serif;
    5566}
    56 .login-wrap{
    57     display: flex;
    58     flex-direction: column;
    59     border: 1px solid #ccc;
    60     box-sizing: border-box;
    61     margin: 0px;
    62     padding: 10px;
     67.login-wrap .log-form-group {
     68  display: flex;
     69  flex-wrap: wrap;
     70  justify-content: left;
     71  margin-bottom: 10px;
    6372}
    64 .log-form-group {
    65     margin: 0px; width: 100%; padding: 5px;
    66 }
    67 .login-wrap input[type=text], input[type=password] {
    68     width: 100%;
    69 }
    70 .login-wrap input[type=submit] {
    71     width: 100%;
    72 }
     73.log-form-group label {
     74  margin: 0;
     75  padding: 0;
     76  margin-right: 10px;
     77  cursor: pointer;
     78}
     79
     80.login-wrap input[type="text"],
     81.login-wrap input[type="password"] {
     82  height: 45px;
     83  width: 100%;
     84  outline: none;
     85  border-radius: 5px;
     86  border: 1px solid #ccc;
     87  padding-left: 15px;
     88  transition: all 0.3s ease;
     89}
     90
     91.login-wrap input[type="text"]:focus,
     92.login-wrap input[type="password"]:focus {
     93  border-color: #007bff;
     94}
     95
     96.login-submit input[type="submit"] {
     97  width: 100%;
     98  padding: 10px;
     99  height: 45px;
     100  outline: none;
     101  border-radius: 5px;
     102  border: 1px solid #ccc;
     103  transition: all 0.3s ease;
     104  cursor: pointer;
     105  font-size: 16px;
     106  letter-spacing: 1px;
     107  margin-right: 10px;
     108}
     109.login-submit input[type="submit"]:hover {
     110  text-decoration: none;
     111}
     112.lw-error {
     113  color: #ff0000;
     114  margin: 0;
     115}
  • login-sidebar-widget/trunk/includes/class-security.php

    r2456366 r2647464  
    11<?php
    22
    3 if(!class_exists('Login_Widget_Admin_Security')){
    4     class Login_Widget_Admin_Security {
    5        
    6         public function __construct(){
    7             $captcha_on_admin_login = (get_option('captcha_on_admin_login') == 'Yes'?true:false);
    8             if($captcha_on_admin_login and in_array( $GLOBALS['pagenow'], array( 'wp-login.php' ) )){
    9                 add_action( 'login_form', array( $this, 'security_add' ) );
    10             }
    11            
    12             $login_ap_forgot_pass_link = get_option('login_ap_forgot_pass_link');
    13             if($login_ap_forgot_pass_link and !in_array( $GLOBALS['pagenow'], array( 'wp-login.php' ) ) ){ 
    14                 add_filter( 'lostpassword_url', array( $this, 'ap_lost_password_url_filter'), 10, 2 );
    15             }
    16            
    17             add_action ( 'ap_login_log_front', array( $this, 'ap_login_log_front_action'), 1, 1 );
    18             add_filter( 'authenticate', array( $this, 'myplugin_auth_signon'), 30, 3 );
    19        
    20             $captcha_on_user_login = (get_option('captcha_on_user_login') == 'Yes'?true:false);
    21             if($captcha_on_user_login){
    22                 add_action( 'login_ap_form', array( $this, 'security_add_user' ) );
    23             }
    24    
    25             if( in_array( $GLOBALS['pagenow'], array( 'wp-login.php' ) ) ){
    26                 add_action('wp_login', array ( $this, 'check_ap_login_success' ) );
    27                 add_filter('login_errors', array( $this, 'check_ap_login_failed' ) );
    28             }
    29         }
    30        
    31         public function ap_lost_password_url_filter( $lostpassword_url, $redirect ) {
    32             $login_ap_forgot_pass_link = get_option('login_ap_forgot_pass_link');
    33             return esc_url( get_permalink($login_ap_forgot_pass_link) );
    34         }
    35    
    36         public function check_ap_login_success(){
    37             $lla = new Login_Log_Adds;
    38             $lla->log_add(apply_filters( 'lwws_log_ip', $_SERVER['REMOTE_ADDR'] ), 'Login success', date("Y-m-d H:i:s"), 'success');
    39         }
    40        
    41         public function check_ap_login_failed( $error ){   
    42             global $errors;
    43             $lla = new Login_Log_Adds;
    44            
    45             if(is_wp_error($errors)) {
    46                 $err_codes = $errors->get_error_codes();
    47             } else {
    48                 return $error;
    49             }
    50            
    51             if ( in_array( 'invalid_username', $err_codes ) or in_array( 'invalid_email', $err_codes ) or in_array( 'incorrect_password', $err_codes ) ) {
    52                 $lla->log_add(apply_filters( 'lwws_log_ip', $_SERVER['REMOTE_ADDR'] ), 'Error in login', date("Y-m-d H:i:s"), 'failed');
    53             }
    54            
    55             // compatibility added for google authenticator plugin
    56             if ( in_array( 'invalid_google_authenticator_token', $err_codes ) ) {
    57                 $lla->log_add(apply_filters( 'lwws_log_ip', $_SERVER['REMOTE_ADDR'] ), 'Invalid google authenticator code', date("Y-m-d H:i:s"), 'failed');
    58             }
    59            
    60             return $error;
    61         }
    62        
    63         public function ap_login_log_front_action( $error ){
    64             $lla = new Login_Log_Adds;
    65             $err_codes = $error->get_error_codes();
    66             if ( in_array( 'invalid_username', $err_codes ) or in_array( 'invalid_email', $err_codes ) or in_array( 'incorrect_password', $err_codes ) ) {
    67                 $lla->log_add(apply_filters( 'lwws_log_ip', $_SERVER['REMOTE_ADDR'] ), 'Error in login', date("Y-m-d H:i:s"), 'failed');
    68             }
    69            
    70             // compatibility added for google authenticator plugin
    71             if ( in_array( 'invalid_google_authenticator_token', $err_codes ) ) {
    72                 $lla->log_add(apply_filters( 'lwws_log_ip', $_SERVER['REMOTE_ADDR'] ), 'Invalid google authenticator code', date("Y-m-d H:i:s"), 'failed');
    73             }
    74            
    75         }
    76        
    77         public function google_recaptcha_put_v2(){
    78             require_once LSW_DIR_PATH . '/recaptcha/recaptchalib_i_am_not_robot.php';
    79             $publickey = get_option('lsw_google_recaptcha_public_key');
    80             $privatekey = get_option('lsw_google_recaptcha_private_key');
    81            
    82             if($publickey == '' or $privatekey == ''){
    83                 _e('Google Recaptcha not configured.','contact-form-with-shortcode');
    84                 return;
    85             }
    86             ?>
    87             <div class="g-recaptcha" data-sitekey="<?php echo $publickey;?>"></div>
     3if (!class_exists('Login_Widget_Admin_Security')) {
     4    class Login_Widget_Admin_Security {
     5
     6        public function __construct() {
     7            $captcha_on_admin_login = (get_option('captcha_on_admin_login') == 'Yes' ? true : false);
     8            if ($captcha_on_admin_login and in_array($GLOBALS['pagenow'], array('wp-login.php'))) {
     9                add_action('login_form', array($this, 'security_add'));
     10            }
     11
     12            $login_ap_forgot_pass_link = get_option('login_ap_forgot_pass_link');
     13            if ($login_ap_forgot_pass_link and !in_array($GLOBALS['pagenow'], array('wp-login.php'))) {
     14                add_filter('lostpassword_url', array($this, 'ap_lost_password_url_filter'), 10, 2);
     15            }
     16
     17            add_action('ap_login_log_front', array($this, 'ap_login_log_front_action'), 1, 1);
     18            add_filter('authenticate', array($this, 'myplugin_auth_signon'), 30, 3);
     19
     20            $captcha_on_user_login = (get_option('captcha_on_user_login') == 'Yes' ? true : false);
     21            if ($captcha_on_user_login) {
     22                add_action('login_ap_form', array($this, 'security_add_user'));
     23            }
     24
     25            if (in_array($GLOBALS['pagenow'], array('wp-login.php'))) {
     26                add_action('wp_login', array($this, 'check_ap_login_success'));
     27                add_filter('login_errors', array($this, 'check_ap_login_failed'));
     28            }
     29        }
     30
     31        public function ap_lost_password_url_filter($lostpassword_url, $redirect) {
     32            $login_ap_forgot_pass_link = get_option('login_ap_forgot_pass_link');
     33            return esc_url(get_permalink($login_ap_forgot_pass_link));
     34        }
     35
     36        public function check_ap_login_success() {
     37            $lla = new Login_Log_Adds;
     38            $lla->log_add(apply_filters('lwws_log_ip', $_SERVER['REMOTE_ADDR']), 'Login success', date("Y-m-d H:i:s"), 'success');
     39        }
     40
     41        public function check_ap_login_failed($error) {
     42            global $errors;
     43            $lla = new Login_Log_Adds;
     44
     45            if (is_wp_error($errors)) {
     46                $err_codes = $errors->get_error_codes();
     47            } else {
     48                return $error;
     49            }
     50
     51            if (in_array('invalid_username', $err_codes) or in_array('invalid_email', $err_codes) or in_array('incorrect_password', $err_codes)) {
     52                $lla->log_add(apply_filters('lwws_log_ip', $_SERVER['REMOTE_ADDR']), 'Error in login', date("Y-m-d H:i:s"), 'failed');
     53            }
     54
     55            // compatibility added for google authenticator plugin
     56            if (in_array('invalid_google_authenticator_token', $err_codes)) {
     57                $lla->log_add(apply_filters('lwws_log_ip', $_SERVER['REMOTE_ADDR']), 'Invalid google authenticator code', date("Y-m-d H:i:s"), 'failed');
     58            }
     59
     60            return $error;
     61        }
     62
     63        public function ap_login_log_front_action($error) {
     64            $lla = new Login_Log_Adds;
     65            $err_codes = $error->get_error_codes();
     66            if (in_array('invalid_username', $err_codes) or in_array('invalid_email', $err_codes) or in_array('incorrect_password', $err_codes)) {
     67                $lla->log_add(apply_filters('lwws_log_ip', $_SERVER['REMOTE_ADDR']), 'Error in login', date("Y-m-d H:i:s"), 'failed');
     68            }
     69
     70            // compatibility added for google authenticator plugin
     71            if (in_array('invalid_google_authenticator_token', $err_codes)) {
     72                $lla->log_add(apply_filters('lwws_log_ip', $_SERVER['REMOTE_ADDR']), 'Invalid google authenticator code', date("Y-m-d H:i:s"), 'failed');
     73            }
     74
     75        }
     76
     77        public function google_recaptcha_put_v2() {
     78            require_once LSW_DIR_PATH . '/recaptcha/recaptchalib_i_am_not_robot.php';
     79            $publickey = get_option('lsw_google_recaptcha_public_key');
     80            $privatekey = get_option('lsw_google_recaptcha_private_key');
     81
     82            if ($publickey == '' or $privatekey == '') {
     83                _e('Google Recaptcha not configured.', 'contact-form-with-shortcode');
     84                return;
     85            }
     86            ?>
     87            <div class="g-recaptcha" data-sitekey="<?php echo $publickey; ?>"></div>
    8888            <script src='https://www.google.com/recaptcha/api.js'></script>
    8989            <?php
    90         }
    91 
    92         public function security_add(){
    93 
    94             if(get_option('captcha_type_in_lsw') == 'recaptcha'){
    95                 include( LSW_DIR_PATH . '/view/admin/recaptcha.php');
    96             } else {
    97                 include( LSW_DIR_PATH . '/view/admin/captcha.php');
    98             }
    99            
    100         }
    101    
    102         public function myplugin_auth_signon( $user, $username, $password ) {
    103             start_session_if_not_started();
    104             $lla = new Login_Log_Adds;
    105            
    106             $captcha_on_admin_login = (get_option('captcha_on_admin_login') == 'Yes'?true:false);
    107             if( $captcha_on_admin_login and in_array( $GLOBALS['pagenow'], array( 'wp-login.php' ) ) ){
    108    
    109                 if(get_option('captcha_type_in_lsw') == 'default'){
    110                    
    111                     if( isset($_POST['admin_captcha']) and sanitize_text_field($_POST['admin_captcha']) != $_SESSION['lsw_captcha_code'] ){
    112                         $lla->log_add(apply_filters( 'lwws_log_ip', $_SERVER['REMOTE_ADDR'] ), 'Security code do not match', date("Y-m-d H:i:s"), 'failed');
    113                         return new WP_Error( 'error_security_code', __( "Security code do not match.", "login-sidebar-widget" ) );
    114                     }
    115 
    116                 } else {
    117                     require_once LSW_DIR_PATH . '/recaptcha/recaptchalib_i_am_not_robot.php';
    118                     $publickey = get_option('lsw_google_recaptcha_public_key');
    119                     $privatekey = get_option('lsw_google_recaptcha_private_key');
    120    
    121                     $reCaptcha = new ReCaptcha($privatekey);
    122                    
    123                     if($publickey == '' or $privatekey == ''){
    124                         wp_die( 'Google Recaptcha not configured!');
    125                     }
    126                     $resp = $reCaptcha->verifyResponse( $_SERVER["REMOTE_ADDR"], $_POST["g-recaptcha-response"] );
    127                     if ($resp == null || !empty($resp->errorCodes)) {
    128                         $lla->log_add(apply_filters( 'lwws_log_ip', $_SERVER['REMOTE_ADDR'] ), 'Recaptcha error', date("Y-m-d H:i:s"), 'failed');
    129                         return new WP_Error( 'error_security_code', __( "Recaptcha error!", "login-sidebar-widget" ) );
    130                     }
    131                 }
    132             }
    133 
    134            
    135             $captcha_on_user_login = (get_option('captcha_on_user_login') == 'Yes'?true:false);
    136             if($captcha_on_user_login and !in_array( $GLOBALS['pagenow'], array( 'wp-login.php' ) )){
    137 
    138                 if(get_option('captcha_type_in_lsw') == 'default'){
    139                    
    140                     if( $captcha_on_user_login and (isset($_POST['user_captcha']) and sanitize_text_field($_POST['user_captcha']) != $_SESSION['lsw_captcha_code']) ){
    141                         $lla->log_add(apply_filters( 'lwws_log_ip', $_SERVER['REMOTE_ADDR'] ), 'Security code do not match', date("Y-m-d H:i:s"), 'failed');
    142                         return new WP_Error( 'error_security_code', __( "Security code do not match.", "login-sidebar-widget" ) );
    143                     }
    144                    
    145                 } else {
    146                     require_once LSW_DIR_PATH . '/recaptcha/recaptchalib_i_am_not_robot.php';
    147                     $publickey = get_option('lsw_google_recaptcha_public_key');
    148                     $privatekey = get_option('lsw_google_recaptcha_private_key');
    149    
    150                     $reCaptcha = new ReCaptcha($privatekey);
    151                    
    152                     if($publickey == '' or $privatekey == ''){
    153                         wp_die( 'Google Recaptcha not configured!');
    154                     }
    155                     $resp = $reCaptcha->verifyResponse( $_SERVER["REMOTE_ADDR"], $_POST["g-recaptcha-response"] );
    156                     if ($resp == null || !empty($resp->errorCodes)) {
    157                         $lla->log_add(apply_filters( 'lwws_log_ip', $_SERVER['REMOTE_ADDR'] ), 'Recaptcha error', date("Y-m-d H:i:s"), 'failed');
    158                         return new WP_Error( 'error_security_code', __( "Recaptcha error!", "login-sidebar-widget" ) );
    159                     }
    160                 }
    161             }
    162                        
    163             // All In One WP Security //
    164             include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    165             if ( is_plugin_active( 'all-in-one-wp-security-and-firewall/wp-security.php' ) ) {
    166                 global $aio_wp_security;
    167                 if ( $aio_wp_security->configs->get_value('aiowps_enable_login_captcha') == '1' ){
    168                     $captcha_error = new WP_Error('authentication_failed', __('<strong>ERROR</strong>: Your answer was incorrect - please try again.', 'all-in-one-wp-security-and-firewall'));
    169                     $captcha_answer = filter_input(INPUT_POST, 'aiowps-captcha-answer', FILTER_VALIDATE_INT);
    170        
    171                     $captcha_temp_string = filter_input(INPUT_POST, 'aiowps-captcha-temp-string', FILTER_SANITIZE_STRING);
    172                     if ( is_null($captcha_temp_string) ){
    173                         $lla->log_add(apply_filters( 'lwws_log_ip', $_SERVER['REMOTE_ADDR'] ), 'Security answer is incorrect', date("Y-m-d H:i:s"), 'failed');
    174                         return $captcha_error;
    175                     }
    176                     $captcha_secret_string = $aio_wp_security->configs->get_value('aiowps_captcha_secret_key');
    177                     $submitted_encoded_string = base64_encode($captcha_temp_string.$captcha_secret_string.$captcha_answer);
    178                     $trans_handle = sanitize_text_field(filter_input(INPUT_POST, 'aiowps-captcha-string-info', FILTER_SANITIZE_STRING));
    179                     $captcha_string_info_trans = (AIOWPSecurity_Utility::is_multisite_install() ? get_site_transient('aiowps_captcha_string_info_'.$trans_handle) : get_transient('aiowps_captcha_string_info_'.$trans_handle));
    180                     if ( $submitted_encoded_string !== $captcha_string_info_trans ){
    181                         $lla->log_add(apply_filters( 'lwws_log_ip', $_SERVER['REMOTE_ADDR'] ), 'Security answer is incorrect', date("Y-m-d H:i:s"), 'failed');
    182                         return $captcha_error;
    183                     }
    184                 }
    185             }
    186             // All In One WP Security //
    187            
    188             return $user;
    189         }
    190        
    191         public function security_add_user(){
    192 
    193             if(get_option('captcha_type_in_lsw') == 'recaptcha'){
    194                 include( LSW_DIR_PATH . '/view/frontend/recaptcha.php');
    195             } else {
    196                 include( LSW_DIR_PATH . '/view/frontend/captcha.php');
    197             }
    198            
    199         }
    200     }
    20190}
    20291
    203 if(!function_exists('security_init')){
    204     function security_init(){
    205         new Login_Widget_Admin_Security;
    206     }
     92        public function security_add() {
     93
     94            if (get_option('captcha_type_in_lsw') == 'recaptcha') {
     95                include LSW_DIR_PATH . '/view/admin/recaptcha.php';
     96            } else {
     97                include LSW_DIR_PATH . '/view/admin/captcha.php';
     98            }
     99
     100        }
     101
     102        public function myplugin_auth_signon($user, $username, $password) {
     103            start_session_if_not_started();
     104            $lla = new Login_Log_Adds;
     105
     106            $captcha_on_admin_login = (get_option('captcha_on_admin_login') == 'Yes' ? true : false);
     107            if ($captcha_on_admin_login and in_array($GLOBALS['pagenow'], array('wp-login.php'))) {
     108
     109                if (get_option('captcha_type_in_lsw') == 'default') {
     110
     111                    if (isset($_POST['admin_captcha']) and sanitize_text_field($_POST['admin_captcha']) != $_SESSION['lsw_captcha_code']) {
     112                        $lla->log_add(apply_filters('lwws_log_ip', $_SERVER['REMOTE_ADDR']), 'Security code do not match', date("Y-m-d H:i:s"), 'failed');
     113                        return new WP_Error('error_security_code', __("Security code do not match.", "login-sidebar-widget"));
     114                    }
     115
     116                } else {
     117                    require_once LSW_DIR_PATH . '/recaptcha/recaptchalib_i_am_not_robot.php';
     118                    $publickey = get_option('lsw_google_recaptcha_public_key');
     119                    $privatekey = get_option('lsw_google_recaptcha_private_key');
     120
     121                    $reCaptcha = new ReCaptcha($privatekey);
     122
     123                    if ($publickey == '' or $privatekey == '') {
     124                        wp_die('Google Recaptcha not configured!');
     125                    }
     126                    $resp = $reCaptcha->verifyResponse(@$_SERVER["REMOTE_ADDR"], @$_POST["g-recaptcha-response"]);
     127                    if ($resp == null || !empty($resp->errorCodes)) {
     128                        $lla->log_add(apply_filters('lwws_log_ip', $_SERVER['REMOTE_ADDR']), 'Recaptcha error', date("Y-m-d H:i:s"), 'failed');
     129                        return new WP_Error('error_security_code', __("Recaptcha error!", "login-sidebar-widget"));
     130                    }
     131                }
     132            }
     133
     134            $captcha_on_user_login = (get_option('captcha_on_user_login') == 'Yes' ? true : false);
     135            if ($captcha_on_user_login and !in_array($GLOBALS['pagenow'], array('wp-login.php'))) {
     136
     137                if (get_option('captcha_type_in_lsw') == 'default') {
     138
     139                    if ($captcha_on_user_login and (isset($_POST['user_captcha']) and sanitize_text_field($_POST['user_captcha']) != $_SESSION['lsw_captcha_code'])) {
     140                        $lla->log_add(apply_filters('lwws_log_ip', $_SERVER['REMOTE_ADDR']), 'Security code do not match', date("Y-m-d H:i:s"), 'failed');
     141                        return new WP_Error('error_security_code', __("Security code do not match.", "login-sidebar-widget"));
     142                    }
     143
     144                } else {
     145                    require_once LSW_DIR_PATH . '/recaptcha/recaptchalib_i_am_not_robot.php';
     146                    $publickey = get_option('lsw_google_recaptcha_public_key');
     147                    $privatekey = get_option('lsw_google_recaptcha_private_key');
     148
     149                    $reCaptcha = new ReCaptcha($privatekey);
     150
     151                    if ($publickey == '' or $privatekey == '') {
     152                        wp_die('Google Recaptcha not configured!');
     153                    }
     154                    $resp = $reCaptcha->verifyResponse($_SERVER["REMOTE_ADDR"], $_POST["g-recaptcha-response"]);
     155                    if ($resp == null || !empty($resp->errorCodes)) {
     156                        $lla->log_add(apply_filters('lwws_log_ip', $_SERVER['REMOTE_ADDR']), 'Recaptcha error', date("Y-m-d H:i:s"), 'failed');
     157                        return new WP_Error('error_security_code', __("Recaptcha error!", "login-sidebar-widget"));
     158                    }
     159                }
     160            }
     161
     162            // All In One WP Security //
     163            include_once ABSPATH . 'wp-admin/includes/plugin.php';
     164            if (is_plugin_active('all-in-one-wp-security-and-firewall/wp-security.php')) {
     165                global $aio_wp_security;
     166                if ($aio_wp_security->configs->get_value('aiowps_enable_login_captcha') == '1') {
     167                    $captcha_error = new WP_Error('authentication_failed', __('<strong>ERROR</strong>: Your answer was incorrect - please try again.', 'all-in-one-wp-security-and-firewall'));
     168                    $captcha_answer = filter_input(INPUT_POST, 'aiowps-captcha-answer', FILTER_VALIDATE_INT);
     169
     170                    $captcha_temp_string = filter_input(INPUT_POST, 'aiowps-captcha-temp-string', FILTER_SANITIZE_STRING);
     171                    if (is_null($captcha_temp_string)) {
     172                        $lla->log_add(apply_filters('lwws_log_ip', $_SERVER['REMOTE_ADDR']), 'Security answer is incorrect', date("Y-m-d H:i:s"), 'failed');
     173                        return $captcha_error;
     174                    }
     175                    $captcha_secret_string = $aio_wp_security->configs->get_value('aiowps_captcha_secret_key');
     176                    $submitted_encoded_string = base64_encode($captcha_temp_string . $captcha_secret_string . $captcha_answer);
     177                    $trans_handle = sanitize_text_field(filter_input(INPUT_POST, 'aiowps-captcha-string-info', FILTER_SANITIZE_STRING));
     178                    $captcha_string_info_trans = (AIOWPSecurity_Utility::is_multisite_install() ? get_site_transient('aiowps_captcha_string_info_' . $trans_handle) : get_transient('aiowps_captcha_string_info_' . $trans_handle));
     179                    if ($submitted_encoded_string !== $captcha_string_info_trans) {
     180                        $lla->log_add(apply_filters('lwws_log_ip', $_SERVER['REMOTE_ADDR']), 'Security answer is incorrect', date("Y-m-d H:i:s"), 'failed');
     181                        return $captcha_error;
     182                    }
     183                }
     184            }
     185            // All In One WP Security //
     186
     187            return $user;
     188        }
     189
     190        public function security_add_user() {
     191
     192            if (get_option('captcha_type_in_lsw') == 'recaptcha') {
     193                include LSW_DIR_PATH . '/view/frontend/recaptcha.php';
     194            } else {
     195                include LSW_DIR_PATH . '/view/frontend/captcha.php';
     196            }
     197
     198        }
     199    }
    207200}
    208201
     202if (!function_exists('security_init')) {
     203    function security_init() {
     204        new Login_Widget_Admin_Security;
     205    }
     206}
  • login-sidebar-widget/trunk/login.php

    r2456366 r2647464  
    44Plugin URI: https://wordpress.org/plugins/login-sidebar-widget/
    55Description: This is a simple login form in the widget. just install the plugin and add the login widget in the sidebar. Thats it. :)
    6 Version: 6.0.9
     6Version: 6.1.0
    77Text Domain: login-sidebar-widget
    88Domain Path: /languages
     
    1111*/
    1212
    13 /**
     13/*
    1414      |||||   
    1515    <(`0_0`)>   
    1616    ()(afo)()
    1717      ()-()
    18 **/
     18*/
    1919
    20 define( 'LSW_DIR_NAME', 'login-sidebar-widget' );
    21 define( 'LSW_DIR_PATH', dirname( __FILE__ ) );
     20define('LSW_DIR_NAME', 'login-sidebar-widget');
     21define('LSW_DIR_PATH', dirname(__FILE__));
    2222
    2323// CONFIG
     
    2525include_once LSW_DIR_PATH . '/config/config-default-fields.php';
    2626
    27 function plug_install_lsw(){
    28     include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    29     if ( is_plugin_active( 'fb-login-widget-pro/login.php' ) || is_plugin_active( 'social-login-no-setup/login.php' ) ) {
    30         wp_die('It seems you have <strong>Facebook Login Widget (PRO)</strong> or <strong>Social Login No Setup</strong> plugin activated. Please deactivate that to continue.');
    31         exit;
    32     }
    33    
    34     include_once LSW_DIR_PATH . '/includes/class-settings.php';
    35     include_once LSW_DIR_PATH . '/includes/class-scripts.php';
    36     include_once LSW_DIR_PATH . '/includes/class-form.php';
    37     include_once LSW_DIR_PATH . '/includes/class-forgot-password.php';
    38     include_once LSW_DIR_PATH . '/includes/class-message.php';
    39     include_once LSW_DIR_PATH . '/includes/class-login-log-adds.php';
    40     include_once LSW_DIR_PATH . '/includes/class-security.php';
    41     include_once LSW_DIR_PATH . '/includes/class-login-log.php';
    42     include_once LSW_DIR_PATH . '/includes/class-paginate.php';
    43     include_once LSW_DIR_PATH . '/includes/class-login-form.php';
    44     include_once LSW_DIR_PATH . '/login-ap-widget.php';
    45     include_once LSW_DIR_PATH . '/process.php';
    46     include_once LSW_DIR_PATH . '/login-ap-widget-shortcode.php';
    47     include_once LSW_DIR_PATH . '/functions.php';
    48    
    49     new Login_Settings;
    50     new Login_Scripts;
    51     new AP_Login_Log;
    52     new AP_Login_Form;
     27function plug_install_lsw() {
     28    include_once ABSPATH . 'wp-admin/includes/plugin.php';
     29    if (is_plugin_active('fb-login-widget-pro/login.php') || is_plugin_active('social-login-no-setup/login.php')) {
     30        wp_die('It seems you have <strong>Facebook Login Widget (PRO)</strong> or <strong>Social Login No Setup</strong> plugin activated. Please deactivate that to continue.');
     31        exit;
     32    }
     33
     34    include_once LSW_DIR_PATH . '/includes/class-settings.php';
     35    include_once LSW_DIR_PATH . '/includes/class-scripts.php';
     36    include_once LSW_DIR_PATH . '/includes/class-form.php';
     37    include_once LSW_DIR_PATH . '/includes/class-forgot-password.php';
     38    include_once LSW_DIR_PATH . '/includes/class-message.php';
     39    include_once LSW_DIR_PATH . '/includes/class-login-log-adds.php';
     40    include_once LSW_DIR_PATH . '/includes/class-security.php';
     41    include_once LSW_DIR_PATH . '/includes/class-login-log.php';
     42    include_once LSW_DIR_PATH . '/includes/class-paginate.php';
     43    include_once LSW_DIR_PATH . '/includes/class-login-form.php';
     44    include_once LSW_DIR_PATH . '/login-ap-widget.php';
     45    include_once LSW_DIR_PATH . '/process.php';
     46    include_once LSW_DIR_PATH . '/login-ap-widget-shortcode.php';
     47    include_once LSW_DIR_PATH . '/functions.php';
     48
     49    new Login_Settings;
     50    new Login_Scripts;
     51    new AP_Login_Log;
     52    new AP_Login_Form;
    5353}
    5454
    5555class LSW_Load_Init {
    56     function __construct() {
    57         plug_install_lsw();
    58     }
     56    function __construct() {
     57        plug_install_lsw();
     58    }
    5959}
    6060
    6161new LSW_Load_Init;
    6262
    63 add_action( 'widgets_init', function(){ register_widget( 'Login_Widget' ); } );
     63add_action('widgets_init', function () {register_widget('Login_Widget');});
    6464
    65 add_action( 'init', 'login_validate' );
    66 add_action( 'init', 'forgot_pass_validate' );
     65add_action('init', 'login_validate');
     66add_action('init', 'forgot_pass_validate');
    6767
    68 add_shortcode( 'login_widget', 'login_widget_ap_shortcode' );
    69 add_shortcode( 'forgot_password', 'forgot_password_ap_shortcode' );
     68add_shortcode('login_widget', 'login_widget_ap_shortcode');
     69add_shortcode('forgot_password', 'forgot_password_ap_shortcode');
    7070
    71 add_action( 'plugins_loaded', 'security_init' );
     71add_action('plugins_loaded', 'security_init');
    7272
    73 add_action( 'plugins_loaded', 'login_widget_ap_text_domain' );
     73add_action('plugins_loaded', 'login_widget_ap_text_domain');
    7474
    75 add_filter( 'lsw_login_errors', 'lsw_login_error_message', 10, 1 );
     75add_filter('lsw_login_errors', 'lsw_login_error_message', 10, 1);
    7676
    77 add_filter( 'lwws_user_captcha_field', 'lwws_user_captcha_field_no_auto', 10, 1 );
     77add_filter('lwws_user_captcha_field', 'lwws_user_captcha_field_no_auto', 10, 1);
    7878
    79 add_filter( 'lwws_admin_captcha_field', 'lwws_user_captcha_field_no_auto', 10, 1 );
     79add_filter('lwws_admin_captcha_field', 'lwws_user_captcha_field_no_auto', 10, 1);
    8080
    81 add_action( 'template_redirect', 'start_session_if_not_started' );
     81add_action('template_redirect', 'start_session_if_not_started');
    8282
    83 register_activation_hook( __FILE__, 'lsw_setup_init' );
     83register_activation_hook(__FILE__, 'lsw_setup_init');
  • login-sidebar-widget/trunk/readme.txt

    r2555330 r2647464  
    44Tags: login, widget, login widget, widget login, sidebar login, login form, user login, authentication, facebook login, twitter login, google login, google plus, facebook, twitter, social login, social media, facebook comments, fb comment, forgot password, reset password, link
    55Requires at least: 2.0.2
    6 Tested up to: 5.7
    7 Stable tag: 6.0.9
     6Tested up to: 5.8.2
     7Stable tag: 6.1.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    158158== Changelog ==
    159159
     160= 6.1.0 =
     161* Improvements.
     162
    160163= 6.0.9 =
    161164* Google reCaptcha added for login security. This can be used instead for default captcha.
  • login-sidebar-widget/trunk/recaptcha/recaptchalib_i_am_not_robot.php

    r2456366 r2647464  
    33 * A ReCaptchaResponse is returned from checkAnswer().
    44 */
    5 class ReCaptchaResponse_1
    6 {
     5class ReCaptchaResponse_1 {
    76    public $success;
    87    public $errorCodes;
    98}
    10 class ReCaptcha
    11 {
     9class ReCaptcha {
    1210    private static $_signupUrl = "https://www.google.com/recaptcha/admin";
    1311    private static $_siteVerifyUrl =
     
    2018     * @param string $secret shared secret between site and ReCAPTCHA server.
    2119     */
    22     function ReCaptcha($secret)
    23     {
     20    function __construct($secret) {
    2421        if ($secret == null || $secret == "") {
    2522            die("To use reCAPTCHA you must get an API key from <a href='"
    2623                . self::$_signupUrl . "'>" . self::$_signupUrl . "</a>");
    2724        }
    28         $this->_secret=$secret;
     25        $this->_secret = $secret;
    2926    }
    3027    /**
     
    3532     * @return string - encoded request.
    3633     */
    37     private function _encodeQS($data)
    38     {
     34    private function _encodeQS($data) {
    3935        $req = "";
    4036        foreach ($data as $key => $value) {
     
    4238        }
    4339        // Cut the last '&'
    44         $req=substr($req, 0, strlen($req)-1);
     40        $req = substr($req, 0, strlen($req) - 1);
    4541        return $req;
    4642    }
     
    5349     * @return array response
    5450     */
    55     private function _submitHTTPGet($path, $data)
    56     {
     51    private function _submitHTTPGet($path, $data) {
    5752        $req = $this->_encodeQS($data);
    5853        $response = file_get_contents($path . $req);
     
    6863     * @return ReCaptchaResponse
    6964     */
    70     public function verifyResponse($remoteIp, $response)
    71     {
     65    public function verifyResponse($remoteIp, $response) {
    7266        // Discard empty solution submissions
    7367        if ($response == null || strlen($response) == 0) {
     
    7973        $getResponse = $this->_submitHttpGet(
    8074            self::$_siteVerifyUrl,
    81             array (
     75            array(
    8276                'secret' => $this->_secret,
    8377                'remoteip' => $remoteIp,
    8478                'v' => self::$_version,
    85                 'response' => $response
     79                'response' => $response,
    8680            )
    8781        );
    8882        $answers = json_decode($getResponse, true);
    8983        $recaptchaResponse = new ReCaptchaResponse_1();
    90         if (trim($answers ['success']) == true) {
     84        if (trim($answers['success']) == true) {
    9185            $recaptchaResponse->success = true;
    9286        } else {
  • login-sidebar-widget/trunk/view/frontend/login.php

    r2445022 r2647464  
    22<div class="login-wrap">
    33
    4     <div id="login-form" class="login-form <?php echo $wid_id;?>">
    5        
     4    <div id="login-form" class="login-form <?php echo $wid_id; ?>">
     5
    66        <?php do_action('lwws_before_login_form_start');?>
    7        
     7
    88        <?php $this->error_message();?>
    9                
    10         <form name="login" id="login" method="post" action="" autocomplete="off" <?php do_action( 'lwws_login_form_tag' );?>>
    11        
    12         <?php if( $nonce_check ){?>
    13         <?php wp_nonce_field( 'login_widget_action', 'login_widget_field' ); ?>
    14         <?php } ?>
    15        
     9
     10        <form name="login" id="login" method="post" action="" autocomplete="off" <?php do_action('lwws_login_form_tag');?>>
     11
     12        <?php if ($nonce_check) {?>
     13        <?php wp_nonce_field('login_widget_action', 'login_widget_field');?>
     14        <?php }?>
     15
    1616        <input type="hidden" name="option" value="ap_user_login" />
    1717        <input type="hidden" name="redirect" value="<?php echo $this->gen_redirect_url(); ?>" />
    1818        <div class="log-form-group">
    19             <label for="userusername"><?php _e('Username','login-sidebar-widget');?> </label>
    20             <input type="text" name="userusername" id="userusername" title="<?php _e('Please enter username','login-sidebar-widget');?>" <?php do_action( 'lwws_userusername_field' );?> required/>
     19            <label for="userusername"><?php _e('Username', 'login-sidebar-widget');?> </label>
     20            <input type="text" name="userusername" id="userusername" title="<?php _e('Please enter username', 'login-sidebar-widget');?>" <?php do_action('lwws_userusername_field');?> required/>
    2121        </div>
    2222        <div class="log-form-group">
    23             <label for="userpassword"><?php _e('Password','login-sidebar-widget');?> </label>
    24             <input type="password" name="userpassword" id="userpassword" title="<?php _e('Please enter password','login-sidebar-widget');?>" <?php do_action( 'lwws_userpassword_field' );?> required/>
     23            <label for="userpassword"><?php _e('Password', 'login-sidebar-widget');?> </label>
     24            <input type="password" name="userpassword" id="userpassword" title="<?php _e('Please enter password', 'login-sidebar-widget');?>" <?php do_action('lwws_userpassword_field');?> required/>
    2525        </div>
    26        
     26
    2727        <?php do_action('login_ap_form');?>
    28        
     28
    2929        <?php do_action('login_form');?>
    30        
     30
    3131        <?php $this->add_remember_me();?>
    32        
    33         <div class="log-form-group"><input name="login" type="submit" value="<?php _e('Login','login-sidebar-widget');?>" <?php do_action( 'lwws_login_form_submit_tag' );?>/></div>
     32
     33        <div class="login-submit"><input name="login" type="submit" value="<?php _e('Login', 'login-sidebar-widget');?>" <?php do_action('lwws_login_form_submit_tag');?>/></div>
     34
    3435        <div class="log-form-group extra-links">
    3536            <?php $this->add_extra_links();?>
    3637        </div>
     38
    3739        </form>
    38        
     40
    3941        <?php do_action('lwws_after_login_form_end');?>
    40        
     42
    4143        </div>
    4244
Note: See TracChangeset for help on using the changeset viewer.