Changeset 2647464
- Timestamp:
- 12/21/2021 05:02:32 PM (4 years ago)
- Location:
- login-sidebar-widget
- Files:
-
- 110 added
- 6 edited
-
tags/6.1.0 (added)
-
tags/6.1.0/captcha (added)
-
tags/6.1.0/captcha/captcha.php (added)
-
tags/6.1.0/captcha/fonts (added)
-
tags/6.1.0/captcha/fonts/AntykwaBold.ttf (added)
-
tags/6.1.0/captcha/fonts/Candice.ttf (added)
-
tags/6.1.0/captcha/fonts/Ding-DongDaddyO.ttf (added)
-
tags/6.1.0/captcha/fonts/Duality.ttf (added)
-
tags/6.1.0/captcha/fonts/Heineken.ttf (added)
-
tags/6.1.0/captcha/fonts/Jura.ttf (added)
-
tags/6.1.0/captcha/fonts/StayPuft.ttf (added)
-
tags/6.1.0/captcha/fonts/TimesNewRomanBold.ttf (added)
-
tags/6.1.0/captcha/fonts/VeraSansBold.ttf (added)
-
tags/6.1.0/config (added)
-
tags/6.1.0/config/config-default-fields.php (added)
-
tags/6.1.0/config/config-emails.php (added)
-
tags/6.1.0/css (added)
-
tags/6.1.0/css/style_login_admin.css (added)
-
tags/6.1.0/css/style_login_widget.css (added)
-
tags/6.1.0/functions.php (added)
-
tags/6.1.0/images (added)
-
tags/6.1.0/images/close.png (added)
-
tags/6.1.0/images/paypal.png (added)
-
tags/6.1.0/images/rss.png (added)
-
tags/6.1.0/includes (added)
-
tags/6.1.0/includes/class-forgot-password.php (added)
-
tags/6.1.0/includes/class-form.php (added)
-
tags/6.1.0/includes/class-login-form.php (added)
-
tags/6.1.0/includes/class-login-log-adds.php (added)
-
tags/6.1.0/includes/class-login-log.php (added)
-
tags/6.1.0/includes/class-message.php (added)
-
tags/6.1.0/includes/class-paginate.php (added)
-
tags/6.1.0/includes/class-scripts.php (added)
-
tags/6.1.0/includes/class-security.php (added)
-
tags/6.1.0/includes/class-settings.php (added)
-
tags/6.1.0/js (added)
-
tags/6.1.0/js/additional-methods.js (added)
-
tags/6.1.0/js/ap-tabs.js (added)
-
tags/6.1.0/js/ap.cookie.js (added)
-
tags/6.1.0/js/jquery.validate.min.js (added)
-
tags/6.1.0/languages (added)
-
tags/6.1.0/languages/login-sidebar-widget-da_DK.mo (added)
-
tags/6.1.0/languages/login-sidebar-widget-da_DK.po (added)
-
tags/6.1.0/languages/login-sidebar-widget-de_DE.mo (added)
-
tags/6.1.0/languages/login-sidebar-widget-de_DE.po (added)
-
tags/6.1.0/languages/login-sidebar-widget-es_ES.mo (added)
-
tags/6.1.0/languages/login-sidebar-widget-es_ES.po (added)
-
tags/6.1.0/languages/login-sidebar-widget-fa_IR.mo (added)
-
tags/6.1.0/languages/login-sidebar-widget-fa_IR.po (added)
-
tags/6.1.0/languages/login-sidebar-widget-fi_FI.mo (added)
-
tags/6.1.0/languages/login-sidebar-widget-fi_FI.po (added)
-
tags/6.1.0/languages/login-sidebar-widget-fr_CH.mo (added)
-
tags/6.1.0/languages/login-sidebar-widget-fr_CH.po (added)
-
tags/6.1.0/languages/login-sidebar-widget-fr_FR.mo (added)
-
tags/6.1.0/languages/login-sidebar-widget-fr_FR.po (added)
-
tags/6.1.0/languages/login-sidebar-widget-fr_GE.mo (added)
-
tags/6.1.0/languages/login-sidebar-widget-fr_GE.po (added)
-
tags/6.1.0/languages/login-sidebar-widget-hu_HU.mo (added)
-
tags/6.1.0/languages/login-sidebar-widget-hu_HU.po (added)
-
tags/6.1.0/languages/login-sidebar-widget-it_IT.mo (added)
-
tags/6.1.0/languages/login-sidebar-widget-it_IT.po (added)
-
tags/6.1.0/languages/login-sidebar-widget-nb_NO.mo (added)
-
tags/6.1.0/languages/login-sidebar-widget-nb_NO.po (added)
-
tags/6.1.0/languages/login-sidebar-widget-nl_NL.mo (added)
-
tags/6.1.0/languages/login-sidebar-widget-nl_NL.po (added)
-
tags/6.1.0/languages/login-sidebar-widget-pl_PL.mo (added)
-
tags/6.1.0/languages/login-sidebar-widget-pl_PL.po (added)
-
tags/6.1.0/languages/login-sidebar-widget-pt_BR.mo (added)
-
tags/6.1.0/languages/login-sidebar-widget-pt_BR.po (added)
-
tags/6.1.0/languages/login-sidebar-widget-pt_PT.mo (added)
-
tags/6.1.0/languages/login-sidebar-widget-pt_PT.po (added)
-
tags/6.1.0/languages/login-sidebar-widget-ru_RU-2.po (added)
-
tags/6.1.0/languages/login-sidebar-widget-ru_RU.mo (added)
-
tags/6.1.0/languages/login-sidebar-widget-ru_RU.po (added)
-
tags/6.1.0/languages/login-sidebar-widget-sl_SI.mo (added)
-
tags/6.1.0/languages/login-sidebar-widget-sl_SI.po (added)
-
tags/6.1.0/languages/login-sidebar-widget-sr_RS.mo (added)
-
tags/6.1.0/languages/login-sidebar-widget-sr_RS.po (added)
-
tags/6.1.0/languages/login-sidebar-widget-sv_SE.mo (added)
-
tags/6.1.0/languages/login-sidebar-widget-sv_SE.po (added)
-
tags/6.1.0/languages/login-sidebar-widget-zh_CN.mo (added)
-
tags/6.1.0/languages/login-sidebar-widget-zh_CN.po (added)
-
tags/6.1.0/languages/login-sidebar-widget.pot (added)
-
tags/6.1.0/login-ap-widget-shortcode.php (added)
-
tags/6.1.0/login-ap-widget.php (added)
-
tags/6.1.0/login.php (added)
-
tags/6.1.0/process.php (added)
-
tags/6.1.0/readme.txt (added)
-
tags/6.1.0/recaptcha (added)
-
tags/6.1.0/recaptcha/recaptchalib.php (added)
-
tags/6.1.0/recaptcha/recaptchalib_i_am_not_robot.php (added)
-
tags/6.1.0/view (added)
-
tags/6.1.0/view/admin (added)
-
tags/6.1.0/view/admin/captcha.php (added)
-
tags/6.1.0/view/admin/donate.php (added)
-
tags/6.1.0/view/admin/help.php (added)
-
tags/6.1.0/view/admin/login-log.php (added)
-
tags/6.1.0/view/admin/login-pro-add.php (added)
-
tags/6.1.0/view/admin/recaptcha.php (added)
-
tags/6.1.0/view/admin/register-pro-add.php (added)
-
tags/6.1.0/view/admin/settings.php (added)
-
tags/6.1.0/view/admin/social-login-add.php (added)
-
tags/6.1.0/view/frontend (added)
-
tags/6.1.0/view/frontend/after-login.php (added)
-
tags/6.1.0/view/frontend/captcha.php (added)
-
tags/6.1.0/view/frontend/forgot-password.php (added)
-
tags/6.1.0/view/frontend/login.php (added)
-
tags/6.1.0/view/frontend/recaptcha.php (added)
-
tags/6.1.0/view/frontend/remember-me-input.php (added)
-
tags/6.1.0/wpml-config.xml (added)
-
trunk/css/style_login_widget.css (modified) (1 diff)
-
trunk/includes/class-security.php (modified) (1 diff)
-
trunk/login.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/recaptcha/recaptchalib_i_am_not_robot.php (modified) (7 diffs)
-
trunk/view/frontend/login.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
login-sidebar-widget/trunk/css/style_login_widget.css
r2445022 r2647464 1 1 .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; 10 11 } 11 12 .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; 19 21 } 20 22 .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; 31 33 } 32 34 .captcha { 33 margin:0px 0px 10px 0px;35 margin: 0px 0px 10px 0px; 34 36 } 35 37 .forgot-pass-form-group { 36 margin: 10px;38 margin: 10px; 37 39 } 38 40 .forgot-pass-form-group label { 39 width: 100%;41 width: 100%; 40 42 } 41 43 .forgot-pass-form-group input[type="email"] { 42 width: 100%;44 width: 100%; 43 45 } 44 46 label.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; 49 51 } 50 52 input.error { 51 border: 1px solid #ff0000 !important;53 border: 1px solid #ff0000 !important; 52 54 } 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; 55 66 } 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; 63 72 } 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 1 1 <?php 2 2 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 plugin56 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 plugin71 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>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> 88 88 <script src='https://www.google.com/recaptcha/api.js'></script> 89 89 <?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 }201 90 } 202 91 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 } 207 200 } 208 201 202 if (!function_exists('security_init')) { 203 function security_init() { 204 new Login_Widget_Admin_Security; 205 } 206 } -
login-sidebar-widget/trunk/login.php
r2456366 r2647464 4 4 Plugin URI: https://wordpress.org/plugins/login-sidebar-widget/ 5 5 Description: 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.96 Version: 6.1.0 7 7 Text Domain: login-sidebar-widget 8 8 Domain Path: /languages … … 11 11 */ 12 12 13 /* *13 /* 14 14 ||||| 15 15 <(`0_0`)> 16 16 ()(afo)() 17 17 ()-() 18 * */18 */ 19 19 20 define( 'LSW_DIR_NAME', 'login-sidebar-widget');21 define( 'LSW_DIR_PATH', dirname( __FILE__ ));20 define('LSW_DIR_NAME', 'login-sidebar-widget'); 21 define('LSW_DIR_PATH', dirname(__FILE__)); 22 22 23 23 // CONFIG … … 25 25 include_once LSW_DIR_PATH . '/config/config-default-fields.php'; 26 26 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;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; 53 53 } 54 54 55 55 class LSW_Load_Init { 56 function __construct() {57 plug_install_lsw();58 }56 function __construct() { 57 plug_install_lsw(); 58 } 59 59 } 60 60 61 61 new LSW_Load_Init; 62 62 63 add_action( 'widgets_init', function(){ register_widget( 'Login_Widget' ); });63 add_action('widgets_init', function () {register_widget('Login_Widget');}); 64 64 65 add_action( 'init', 'login_validate');66 add_action( 'init', 'forgot_pass_validate');65 add_action('init', 'login_validate'); 66 add_action('init', 'forgot_pass_validate'); 67 67 68 add_shortcode( 'login_widget', 'login_widget_ap_shortcode');69 add_shortcode( 'forgot_password', 'forgot_password_ap_shortcode');68 add_shortcode('login_widget', 'login_widget_ap_shortcode'); 69 add_shortcode('forgot_password', 'forgot_password_ap_shortcode'); 70 70 71 add_action( 'plugins_loaded', 'security_init');71 add_action('plugins_loaded', 'security_init'); 72 72 73 add_action( 'plugins_loaded', 'login_widget_ap_text_domain');73 add_action('plugins_loaded', 'login_widget_ap_text_domain'); 74 74 75 add_filter( 'lsw_login_errors', 'lsw_login_error_message', 10, 1);75 add_filter('lsw_login_errors', 'lsw_login_error_message', 10, 1); 76 76 77 add_filter( 'lwws_user_captcha_field', 'lwws_user_captcha_field_no_auto', 10, 1);77 add_filter('lwws_user_captcha_field', 'lwws_user_captcha_field_no_auto', 10, 1); 78 78 79 add_filter( 'lwws_admin_captcha_field', 'lwws_user_captcha_field_no_auto', 10, 1);79 add_filter('lwws_admin_captcha_field', 'lwws_user_captcha_field_no_auto', 10, 1); 80 80 81 add_action( 'template_redirect', 'start_session_if_not_started');81 add_action('template_redirect', 'start_session_if_not_started'); 82 82 83 register_activation_hook( __FILE__, 'lsw_setup_init');83 register_activation_hook(__FILE__, 'lsw_setup_init'); -
login-sidebar-widget/trunk/readme.txt
r2555330 r2647464 4 4 Tags: 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 5 5 Requires at least: 2.0.2 6 Tested up to: 5. 77 Stable tag: 6. 0.96 Tested up to: 5.8.2 7 Stable tag: 6.1.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 158 158 == Changelog == 159 159 160 = 6.1.0 = 161 * Improvements. 162 160 163 = 6.0.9 = 161 164 * 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 3 3 * A ReCaptchaResponse is returned from checkAnswer(). 4 4 */ 5 class ReCaptchaResponse_1 6 { 5 class ReCaptchaResponse_1 { 7 6 public $success; 8 7 public $errorCodes; 9 8 } 10 class ReCaptcha 11 { 9 class ReCaptcha { 12 10 private static $_signupUrl = "https://www.google.com/recaptcha/admin"; 13 11 private static $_siteVerifyUrl = … … 20 18 * @param string $secret shared secret between site and ReCAPTCHA server. 21 19 */ 22 function ReCaptcha($secret) 23 { 20 function __construct($secret) { 24 21 if ($secret == null || $secret == "") { 25 22 die("To use reCAPTCHA you must get an API key from <a href='" 26 23 . self::$_signupUrl . "'>" . self::$_signupUrl . "</a>"); 27 24 } 28 $this->_secret =$secret;25 $this->_secret = $secret; 29 26 } 30 27 /** … … 35 32 * @return string - encoded request. 36 33 */ 37 private function _encodeQS($data) 38 { 34 private function _encodeQS($data) { 39 35 $req = ""; 40 36 foreach ($data as $key => $value) { … … 42 38 } 43 39 // Cut the last '&' 44 $req =substr($req, 0, strlen($req)-1);40 $req = substr($req, 0, strlen($req) - 1); 45 41 return $req; 46 42 } … … 53 49 * @return array response 54 50 */ 55 private function _submitHTTPGet($path, $data) 56 { 51 private function _submitHTTPGet($path, $data) { 57 52 $req = $this->_encodeQS($data); 58 53 $response = file_get_contents($path . $req); … … 68 63 * @return ReCaptchaResponse 69 64 */ 70 public function verifyResponse($remoteIp, $response) 71 { 65 public function verifyResponse($remoteIp, $response) { 72 66 // Discard empty solution submissions 73 67 if ($response == null || strlen($response) == 0) { … … 79 73 $getResponse = $this->_submitHttpGet( 80 74 self::$_siteVerifyUrl, 81 array (75 array( 82 76 'secret' => $this->_secret, 83 77 'remoteip' => $remoteIp, 84 78 'v' => self::$_version, 85 'response' => $response 79 'response' => $response, 86 80 ) 87 81 ); 88 82 $answers = json_decode($getResponse, true); 89 83 $recaptchaResponse = new ReCaptchaResponse_1(); 90 if (trim($answers ['success']) == true) {84 if (trim($answers['success']) == true) { 91 85 $recaptchaResponse->success = true; 92 86 } else { -
login-sidebar-widget/trunk/view/frontend/login.php
r2445022 r2647464 2 2 <div class="login-wrap"> 3 3 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 6 6 <?php do_action('lwws_before_login_form_start');?> 7 7 8 8 <?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 16 16 <input type="hidden" name="option" value="ap_user_login" /> 17 17 <input type="hidden" name="redirect" value="<?php echo $this->gen_redirect_url(); ?>" /> 18 18 <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/> 21 21 </div> 22 22 <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/> 25 25 </div> 26 26 27 27 <?php do_action('login_ap_form');?> 28 28 29 29 <?php do_action('login_form');?> 30 30 31 31 <?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 34 35 <div class="log-form-group extra-links"> 35 36 <?php $this->add_extra_links();?> 36 37 </div> 38 37 39 </form> 38 40 39 41 <?php do_action('lwws_after_login_form_end');?> 40 42 41 43 </div> 42 44
Note: See TracChangeset
for help on using the changeset viewer.