Changeset 3063121
- Timestamp:
- 04/03/2024 02:44:29 AM (2 years ago)
- Location:
- admintosh/trunk
- Files:
-
- 4 edited
-
admintosh.php (modified) (1 diff)
-
inc/Limit_Login_Attempts.php (modified) (8 diffs)
-
languages/admintosh.pot (modified) (16 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
admintosh/trunk/admintosh.php
r3022674 r3063121 4 4 Plugin URI: http://wpmobo.com/admintosh 5 5 Description: WordPress admin customization and security tools 6 Version: 1.0. 16 Version: 1.0.2 7 7 Author: wpmobo 8 8 Author URI: http://wpmobo.com -
admintosh/trunk/inc/Limit_Login_Attempts.php
r3022674 r3063121 12 12 class Limit_Login_Attempts { 13 13 14 private $failed_login_limit;15 private $lockout_duration; //Sureyi sn cinsinden giriniz. 30 dakika: 60*30 = 180016 private $transient_name = 'admintosh_attempted_login';14 private $failed_login_limit; 15 private $lockout_duration; //Sureyi sn cinsinden giriniz. 30 dakika: 60*30 = 1800 16 private $transient_name = 'admintosh_attempted_login'; 17 17 18 function __construct() { 18 private $username; 19 20 function __construct() { 19 21 20 22 $opt = get_option( 'admintosh_options' ); … … 24 26 $this->lockout_duration = 60 * $duration; 25 27 26 add_filter( 'authenticate', array( $this, 'check_attempted_login' ), 30, 3 ); 27 add_action( 'wp_login_failed', array( $this, 'login_failed' ), 10, 1 ); 28 add_filter( 'authenticate', array( $this, 'check_attempted_login' ), 30, 3 ); 29 add_action( 'wp_login_failed', array( $this, 'login_failed' ), 10, 1 ); 30 add_action( 'login_errors', array( $this, 'login_errors_msg' ), 10, 1 ); 28 31 29 }32 } 30 33 31 34 protected function getTransientName($username) { … … 33 36 } 34 37 35 public function check_attempted_login( $user, $username, $password ) {38 public function check_attempted_login( $user, $username, $password ) { 36 39 $error = new \WP_Error(); 37 40 38 41 $transientName = $this->getTransientName($username); 39 42 … … 46 49 $time = $this->when( $until ); 47 50 //Display error message to the user when limit is reached 48 $error->add( 'too_many_tried', sprintf( __( 'To many failed login attempts. Please login after %1$s' ) , $time ) ); 49 50 return $error; 51 } 52 53 if( !empty( $datas['tried'] ) && $datas['tried'] < $this->failed_login_limit ) { 54 $error->add( 'limit_remind', ($this->failed_login_limit - $datas['tried']).' attempts remaining.' ); 51 $error->add( 'too_many_tried', sprintf( __( 'To many failed login attempts. Please login after %1$s', 'admintosh' ) , $time ) ); 55 52 56 53 return $error; … … 58 55 59 56 } 57 60 58 return $user; 61 59 62 }60 } 63 61 64 public function login_failed( $username ) { 62 public function login_failed( $username ) { 63 64 $this->username = $username; 65 65 66 66 $transientName = $this->getTransientName($username); … … 68 68 $datas = get_transient( $transientName ); 69 69 70 if ( !empty( $datas['tried'] ) ) {70 if ( !empty( $datas['tried'] ) ) { 71 71 $datas['tried']++; 72 72 if ( $datas['tried'] <= $this->failed_login_limit ) { … … 80 80 } 81 81 82 }82 } 83 83 84 private function when( $time ) {84 private function when( $time ) { 85 85 if ( ! $time ) 86 86 return; … … 103 103 104 104 105 public function login_errors_msg( $error ) { 106 107 108 $transientName = $this->getTransientName($this->username); 109 110 if ( get_transient( $transientName ) ) { 111 112 $datas = get_transient( $transientName ); 113 if ( $datas['tried'] >= $this->failed_login_limit ) { 114 $until = get_option( '_transient_timeout_' . $transientName ); 115 116 $time = $this->when( $until ); 117 //Display error message to the user when limit is reached 118 $error = sprintf( __( 'To many failed login attempts. Please login after %1$s', 'admintosh' ) , $time ); 119 } 120 121 if( !empty( $datas['tried'] ) && $datas['tried'] < $this->failed_login_limit ) { 122 $error .= sprintf( __( '%1$s %2$s attempts remaining.%3$s', 'admintosh' ) , '<p style="color: #ff0000;margin-top: 8px;"><strong>', ($this->failed_login_limit - $datas['tried']), '</strong></p>' ); 123 } 124 125 } 126 127 return $error; 128 129 } 130 131 105 132 } -
admintosh/trunk/languages/admintosh.pot
r3022674 r3063121 4 4 "Project-Id-Version: Admintosh\n" 5 5 "Report-Msgid-Bugs-To: \n" 6 "POT-Creation-Date: 2024-0 1-16 22:26+0000\n"6 "POT-Creation-Date: 2024-04-03 02:39+0000\n" 7 7 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 8 8 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 14 14 "Content-Transfer-Encoding: 8bit\n" 15 15 "X-Generator: Loco https://localise.biz/\n" 16 "X-Loco-Version: 2.6.6; wp-6. 4.2\n"16 "X-Loco-Version: 2.6.6; wp-6.5\n" 17 17 "X-Domain: admintosh" 18 19 #: inc/Limit_Login_Attempts.php:122 20 #, php-format 21 msgid "%1$s %2$s attempts remaining.%3$s" 22 msgstr "" 18 23 19 24 #: admin/Admin.php:147 … … 21 26 msgstr "" 22 27 23 #: admin/Admin.php: 39228 #: admin/Admin.php:428 24 29 msgid "Active Login Captcha" 25 30 msgstr "" 26 31 27 #: admin/Admin.php:4 0032 #: admin/Admin.php:436 28 33 msgid "Addition Captcha" 29 34 msgstr "" 30 35 31 #: admin/Admin.php:2 1636 #: admin/Admin.php:234 32 37 msgid "Admin Background Color" 33 38 msgstr "" … … 37 42 msgstr "" 38 43 39 #: admin/Admin.php:2 2044 #: admin/Admin.php:238 40 45 msgid "Admin Menu Hover Background Color" 41 46 msgstr "" 42 47 43 #: admin/Admin.php:2 2848 #: admin/Admin.php:246 44 49 msgid "Admin Menu Hover Link Color" 45 50 msgstr "" 46 51 47 #: admin/Admin.php:2 2452 #: admin/Admin.php:242 48 53 msgid "Admin Menu Link Color" 49 54 msgstr "" 50 55 51 #: admin/Admin.php:2 3256 #: admin/Admin.php:250 52 57 msgid "Admin Sub Menu Background Color" 53 58 msgstr "" 54 59 55 #: admin/Admin.php:2 3660 #: admin/Admin.php:254 56 61 msgid "Admin Sub Menu Link Color" 57 62 msgstr "" … … 61 66 msgstr "" 62 67 63 #: admin/Admin.php:1 7168 #: admin/Admin.php:180 64 69 msgid "Admin Top Bar Background Color" 65 70 msgstr "" 66 71 67 #: admin/Admin.php:1 7972 #: admin/Admin.php:188 68 73 msgid "Admin Top Bar Link Color" 69 74 msgstr "" 70 75 71 #: admin/Admin.php:1 8376 #: admin/Admin.php:192 72 77 msgid "Admin Top Bar Link Hover Background Color" 73 78 msgstr "" 74 79 75 #: admin/Admin.php:1 8780 #: admin/Admin.php:196 76 81 msgid "Admin Top Bar Link Hover Color" 77 82 msgstr "" 78 83 79 #: admin/Admin.php: 19184 #: admin/Admin.php:200 80 85 msgid "Admin Top bar Logo" 81 86 msgstr "" 82 87 83 #: admin/Admin.php:1 7588 #: admin/Admin.php:184 84 89 msgid "Admin Top Bar Text Color" 85 90 msgstr "" … … 94 99 msgstr "" 95 100 96 #: admin/Admin.php:2 57101 #: admin/Admin.php:284 97 102 msgid "Background Color" 98 103 msgstr "" 99 104 100 #: admin/Admin.php:2 62105 #: admin/Admin.php:289 101 106 msgid "Background Image" 102 107 msgstr "" 103 108 104 #: admin/Admin.php:3 21109 #: admin/Admin.php:357 105 110 msgid "Border" 106 111 msgstr "" 107 112 108 #: admin/Admin.php:3 59113 #: admin/Admin.php:395 109 114 msgid "Button Background Color" 110 115 msgstr "" 111 116 112 #: admin/Admin.php: 367117 #: admin/Admin.php:403 113 118 msgid "Button Border Color" 114 119 msgstr "" 115 120 116 #: admin/Admin.php: 371121 #: admin/Admin.php:407 117 122 msgid "Button Hover Background Color" 118 123 msgstr "" 119 124 120 #: admin/Admin.php: 379125 #: admin/Admin.php:415 121 126 msgid "Button Hover Border Color" 122 127 msgstr "" 123 128 124 #: admin/Admin.php: 375129 #: admin/Admin.php:411 125 130 msgid "Button Hover Text Color" 126 131 msgstr "" 127 132 128 #: admin/Admin.php:3 63133 #: admin/Admin.php:399 129 134 msgid "Button Text Color" 130 135 msgstr "" … … 138 143 msgstr "" 139 144 140 #: admin/Admin.php: 396145 #: admin/Admin.php:432 141 146 msgid "Captcha Type" 147 msgstr "" 148 149 #: admin/Admin.php:170 admin/Admin.php:224 admin/Admin.php:274 150 #: admin/Admin.php:335 151 msgid "Color Preset" 142 152 msgstr "" 143 153 … … 166 176 msgstr "" 167 177 168 #: admin/Admin.php:4 30178 #: admin/Admin.php:466 169 179 msgid "Duration In Minute" 170 180 msgstr "" 171 181 172 #: admin/Admin.php:4 24182 #: admin/Admin.php:460 173 183 msgid "Failed Login Limit" 174 184 msgstr "" 175 185 176 #: admin/Admin.php:3 55186 #: admin/Admin.php:391 177 187 msgid "Form Button Style" 178 188 msgstr "" 179 189 180 #: admin/Admin.php: 399190 #: admin/Admin.php:435 181 191 msgid "Google reCAPTCHA" 182 192 msgstr "" 183 193 184 #: admin/Admin.php:4 11194 #: admin/Admin.php:447 185 195 msgid "Google reCAPTCHA Secret key" 186 196 msgstr "" 187 197 188 #: admin/Admin.php:4 05198 #: admin/Admin.php:441 189 199 msgid "Google reCAPTCHA Site Key" 190 200 msgstr "" … … 202 212 msgstr "" 203 213 204 #: admin/Admin.php:3 30214 #: admin/Admin.php:366 205 215 msgid "Input Field Background Color" 206 216 msgstr "" 207 217 208 #: admin/Admin.php:3 38218 #: admin/Admin.php:374 209 219 msgid "Input Field Border" 210 220 msgstr "" 211 221 212 #: admin/Admin.php:3 42222 #: admin/Admin.php:378 213 223 msgid "Input Field Padding" 214 224 msgstr "" 215 225 216 #: admin/Admin.php:3 34226 #: admin/Admin.php:370 217 227 msgid "Input Field Text Color" 218 228 msgstr "" 219 229 220 #: admin/Admin.php:3 26230 #: admin/Admin.php:362 221 231 msgid "Input Fields Style" 222 232 msgstr "" 223 233 224 #: admin/Admin.php: 294234 #: admin/Admin.php:321 225 235 msgid "Link Color" 226 236 msgstr "" 227 237 228 #: admin/Admin.php: 298238 #: admin/Admin.php:325 229 239 msgid "Link Hover Color" 230 240 msgstr "" … … 234 244 msgstr "" 235 245 236 #: admin/Admin.php:4 29246 #: admin/Admin.php:465 237 247 msgid "Lockout Duration" 238 248 msgstr "" … … 242 252 msgstr "" 243 253 244 #: admin/Admin.php:3 51254 #: admin/Admin.php:387 245 255 msgid "Login Button Margin" 246 256 msgstr "" 247 257 248 #: admin/Admin.php:3 47258 #: admin/Admin.php:383 249 259 msgid "Login Button Padding" 250 260 msgstr "" 251 261 252 #: admin/Admin.php:3 09262 #: admin/Admin.php:345 253 263 msgid "Login Form Background Color" 254 264 msgstr "" 255 265 256 #: admin/Admin.php:3 13266 #: admin/Admin.php:349 257 267 msgid "Login Form Background Image" 258 268 msgstr "" 259 269 260 #: admin/Admin.php:2 49270 #: admin/Admin.php:267 261 271 msgid "Login Form Style" 262 272 msgstr "" … … 270 280 msgstr "" 271 281 272 #: admin/Admin.php:2 48282 #: admin/Admin.php:266 273 283 msgid "Login Page Style" 274 284 msgstr "" … … 278 288 msgstr "" 279 289 280 #: admin/Admin.php:2 66290 #: admin/Admin.php:293 281 291 msgid "Logo" 282 292 msgstr "" 283 293 284 #: admin/Admin.php:20 0 admin/Admin.php:274294 #: admin/Admin.php:209 admin/Admin.php:301 285 295 msgid "Logo Height" 286 296 msgstr "" 287 297 288 #: admin/Admin.php:2 05298 #: admin/Admin.php:214 289 299 msgid "Logo Margin" 290 300 msgstr "" 291 301 292 #: admin/Admin.php: 278302 #: admin/Admin.php:305 293 303 msgid "Logo Size" 294 304 msgstr "" 295 305 296 #: admin/Admin.php: 195 admin/Admin.php:270306 #: admin/Admin.php:204 admin/Admin.php:297 297 307 msgid "Logo Width" 298 308 msgstr "" 299 309 300 #: admin/Admin.php: 282310 #: admin/Admin.php:309 301 311 msgid "Logo/Site Name Margin Bottom" 302 312 msgstr "" … … 310 320 msgstr "" 311 321 312 #: admin/Admin.php:4 01322 #: admin/Admin.php:437 313 323 msgid "Random Number Captcha" 314 324 msgstr "" 315 325 316 #: admin/Admin.php:4 07 admin/Admin.php:413326 #: admin/Admin.php:443 admin/Admin.php:449 317 327 #, php-format 318 328 msgid "" … … 324 334 msgstr "" 325 335 326 #: admin/Admin.php: 286336 #: admin/Admin.php:313 327 337 msgid "Site Name" 328 338 msgstr "" … … 332 342 msgstr "" 333 343 334 #: admin/Admin.php: 290 admin/Admin.php:317344 #: admin/Admin.php:317 admin/Admin.php:353 335 345 msgid "Text Color" 346 msgstr "" 347 348 #: inc/Limit_Login_Attempts.php:51 inc/Limit_Login_Attempts.php:118 349 #, php-format 350 msgid "To many failed login attempts. Please login after %1$s" 336 351 msgstr "" 337 352 -
admintosh/trunk/readme.txt
r3022674 r3063121 4 4 Tags: customize dashboard, customize admin menu, customize login page, security tools, captcha, recaptcha, admin menu, dashboard, admin bar, login page, customize admin 5 5 Requires PHP: 7.4 6 Requires at least: 6. 4.27 Tested up to: 6. 4.28 Stable tag: 1.0. 19 Version: 1.0. 16 Requires at least: 6.5 7 Tested up to: 6.5 8 Stable tag: 1.0.2 9 Version: 1.0.2 10 10 License: GPLv2 or later 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 82 82 == Changelog == 83 83 84 = 1.0.2 = 85 86 - Fixed login attempts wrong count issue 87 - Added Update translate POT file 88 - WordPress 6.5 Compatibility Check 89 90 84 91 = 1.0.1 = 85 Added Limit Login Attempts Feature86 Fixed Session Conflict Issue92 - Added Limit Login Attempts Feature 93 - Fixed Session Conflict Issue 87 94 88 95 = 1.0.0 =
Note: See TracChangeset
for help on using the changeset viewer.