Changeset 2640310
- Timestamp:
- 12/07/2021 01:20:31 AM (4 years ago)
- Location:
- code9/trunk
- Files:
-
- 3 added
- 5 edited
-
code9.php (modified) (2 diffs)
-
function/code9_security.php (modified) (1 diff)
-
plugin/security/api/index.php (added)
-
plugin/security/api/security_2_step_blockingtime_update.php (added)
-
plugin/security/spa/index.php (added)
-
plugin/security/spa/security.js (modified) (9 diffs)
-
plugin/security/spa/security.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
code9/trunk/code9.php
r2629539 r2640310 4 4 Plugin URI: https://wordpress.org/plugins/code9/ 5 5 Description: Utility tool for wordpress. 2-step verificatoin code user login. 6 Version: 1.0. 56 Version: 1.0.6 7 7 Author: Code9Fair 8 8 Author URI: https://paypal.me/code9fair/ … … 43 43 include($GLOBALS['CODE9_PLUGIN_DIR'] . 'plugin/security/api/security_2_step_key_iv_reset.php'); 44 44 include($GLOBALS['CODE9_PLUGIN_DIR'] . 'plugin/security/api/security_2_step_update.php'); 45 include($GLOBALS['CODE9_PLUGIN_DIR'] . 'plugin/security/api/security_2_step_blockingtime_update.php'); 45 46 include($GLOBALS['CODE9_PLUGIN_DIR'] . 'plugin/security/api/security_anti_brute_force_update.php'); 46 47 include($GLOBALS['CODE9_PLUGIN_DIR'] . 'plugin/security/api/security_anti_brute_force_blocked_remove.php'); -
code9/trunk/function/code9_security.php
r2615536 r2640310 145 145 146 146 if ($_SESSION['code9_security_auth_' . $admin_id . '_attemp'] > 3) { 147 $_SESSION['code9_security_auth_' . $admin_id . '_block_time'] = time() + 180;147 $_SESSION['code9_security_auth_' . $admin_id . '_block_time'] = time() + intval(get_option('code9_security_2_step_blockingtime', '180')); 148 148 149 149 throw new Exception('Your account has been temporarily locked'); -
code9/trunk/plugin/security/spa/security.js
r2615536 r2640310 23 23 type: "checkbox", 24 24 }) 25 .on("change", function () {26 C9_API("security_2_step_update", {25 .on("change", async function () { 26 var _response = await C9_API("security_2_step_update", { 27 27 security_2_step: 28 28 $(this).prop("checked") === true ? "1" : "0", 29 29 }); 30 31 C9_NOTI(_response.response_text); 30 32 }) 31 33 .prop( … … 38 40 ]) 39 41 ), 42 $("<div>") 43 .attr({ 44 class: "c9-margin-bottom-small", 45 }) 46 .html([ 47 $("<label>").html(__("Blocking time (second)")).attr({ 48 class: "c9-margin-bottom-small", 49 }), 50 $("<div>").html( 51 $("<input>") 52 .attr({ 53 type: "number", 54 class: "c9-margin-bottom-small", 55 }) 56 .val($("#c9-security_2_step_blockingtime-value").val()) 57 .on("change", async function () { 58 var _response = await C9_API( 59 "security_2_step_blockingtime_update", 60 { 61 timeout: $(this).val(), 62 } 63 ); 64 65 C9_NOTI(_response.response_text); 66 }) 67 ), 68 ]), 40 69 $("<button>") 41 70 .attr({ … … 74 103 type: "checkbox", 75 104 }) 76 .on("change", function () { 77 C9_API("security_anti_brute_force_update", { 78 security_anti_brute_force: 79 $(this).prop("checked") === true ? "1" : "0", 80 }); 105 .on("change", async function () { 106 var _response = await C9_API( 107 "security_anti_brute_force_update", 108 { 109 security_anti_brute_force: 110 $(this).prop("checked") === true ? "1" : "0", 111 } 112 ); 113 114 C9_NOTI(_response.response_text); 81 115 }) 82 116 .prop( … … 101 135 if (tab_index === 1) { 102 136 (async function () { 103 var _response = await C9_API("security_anti_brute_force_logs_get"); 137 var _response = await C9_API( 138 "security_anti_brute_force_logs_get" 139 ); 104 140 105 141 var _data = []; … … 109 145 var _attacker = data.option_name.split("[]"); 110 146 111 if (!_attacker[1]) return;147 if (!_attacker[1]) return; 112 148 113 149 _data.push({ … … 115 151 ip: _attacker[2], 116 152 amount: data.option_value, 117 unblock: data.option_name153 unblock: data.option_name, 118 154 }); 119 155 }); … … 132 168 name: "unblock", 133 169 formatter: (data) => { 134 return gridjs.html( 135 `<button class="button action c9-anti-brute-force-unblock-button" data-id="${encodeURIComponent(data)}">Unblock</button>` 170 return gridjs.html( 171 `<button class="button action c9-anti-brute-force-unblock-button" data-id="${encodeURIComponent( 172 data 173 )}">Unblock</button>` 136 174 ); 137 } 138 , 175 }, 139 176 }, 140 177 ], … … 154 191 document.getElementById("c9-brute-force-table-container") 155 192 ) 156 .forceRender().on('ready', function() { 157 $('.c9-anti-brute-force-unblock-button').on('click', function() { 158 159 var _dom = $(this); 160 161 _anti_brute_force_blocked_remove(_dom.attr('data-id'), function() { 162 _dom.replaceWith('<span class="dashicons dashicons-yes"></span>') 163 }) 164 }) 193 .forceRender() 194 .on("ready", function () { 195 $(".c9-anti-brute-force-unblock-button").on( 196 "click", 197 function () { 198 var _dom = $(this); 199 200 _anti_brute_force_blocked_remove( 201 _dom.attr("data-id"), 202 function () { 203 _dom.replaceWith( 204 '<span class="dashicons dashicons-yes"></span>' 205 ); 206 } 207 ); 208 } 209 ); 165 210 }); 166 167 211 })(); 168 212 } … … 172 216 ); 173 217 174 var _anti_brute_force_blocked_remove = async function(id, callback) { 175 var _response = await C9_API('security_anti_brute_force_blocked_remove', {id: decodeURIComponent(id)}); 176 177 console.log(_response); 218 var _anti_brute_force_blocked_remove = async function (id, callback) { 219 var _response = await C9_API("security_anti_brute_force_blocked_remove", { 220 id: decodeURIComponent(id), 221 }); 222 223 C9_NOTI(_response.response_text); 224 178 225 callback(); 179 226 }; -
code9/trunk/plugin/security/spa/security.php
r2615536 r2640310 5 5 <div id="c9-security-tab-container"></div> 6 6 <input type="hidden" value="<?php echo get_option('code9_security_2_step', '0');?>" id="c9-security_2_step-value" /> 7 <input type="hidden" value="<?php echo get_option('code9_security_2_step_blockingtime', '180');?>" id="c9-security_2_step_blockingtime-value" /> 7 8 <input type="hidden" value="<?php echo get_option('code9_security_anti_brute_force', '0');?>" id="c9-security_security_anti_brute_force-value" /> 8 9 </div> -
code9/trunk/readme.txt
r2629539 r2640310 5 5 Requires at least: 4.1 6 6 Tested up to: 5.8 7 Stable tag: 1.0. 57 Stable tag: 1.0.6 8 8 Requires PHP: 5.6.4 9 9 License: GPLv2 … … 63 63 = 1.0.5 = 64 64 * Show data on log tabs when attacker try to login more than 2 attempts. 65 = 1.0.6 = 66 * Add 2 step verification code blocking time setting.
Note: See TracChangeset
for help on using the changeset viewer.