Plugin Directory

Changeset 3063121


Ignore:
Timestamp:
04/03/2024 02:44:29 AM (2 years ago)
Author:
wpmobo
Message:

Update 1.0.2

  • Fixed login attempts wrong count issue
  • Added Update translate POT file
  • WordPress 6.5 Compatibility Check
Location:
admintosh/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • admintosh/trunk/admintosh.php

    r3022674 r3063121  
    44Plugin URI:   http://wpmobo.com/admintosh
    55Description:  WordPress admin customization and security tools
    6 Version:      1.0.1
     6Version:      1.0.2
    77Author:       wpmobo
    88Author URI:   http://wpmobo.com
  • admintosh/trunk/inc/Limit_Login_Attempts.php

    r3022674 r3063121  
    1212class Limit_Login_Attempts {
    1313
    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';
     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';
    1717
    18     function __construct() {
     18    private $username;
     19
     20    function __construct() {
    1921
    2022        $opt = get_option( 'admintosh_options' );
     
    2426        $this->lockout_duration = 60 * $duration;
    2527
    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 );
    2831
    29     }
     32    }
    3033
    3134    protected function getTransientName($username) {
     
    3336    }
    3437
    35     public function check_attempted_login( $user, $username, $password ) {
     38    public function check_attempted_login( $user, $username, $password ) {
    3639        $error = new \WP_Error();
    37          
     40         
    3841          $transientName = $this->getTransientName($username);
    3942
     
    4649                $time = $this->when( $until );
    4750                //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 ) );
    5552
    5653                return $error;
     
    5855
    5956        }
     57
    6058        return $user;
    6159
    62     }
     60    }
    6361
    64     public function login_failed( $username ) {
     62    public function login_failed( $username ) {
     63
     64        $this->username = $username;
    6565
    6666        $transientName = $this->getTransientName($username);
     
    6868        $datas = get_transient( $transientName );
    6969
    70         if ( !empty( $datas['tried'] ) ) {
     70        if ( !empty( $datas['tried'] ) ) {
    7171            $datas['tried']++;
    7272            if ( $datas['tried'] <= $this->failed_login_limit ) {
     
    8080        }
    8181
    82     }
     82    }
    8383
    84     private function when( $time ) {
     84    private function when( $time ) {
    8585        if ( ! $time )
    8686        return;
     
    103103
    104104
     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
    105132}
  • admintosh/trunk/languages/admintosh.pot

    r3022674 r3063121  
    44"Project-Id-Version: Admintosh\n"
    55"Report-Msgid-Bugs-To: \n"
    6 "POT-Creation-Date: 2024-01-16 22:26+0000\n"
     6"POT-Creation-Date: 2024-04-03 02:39+0000\n"
    77"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    88"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1414"Content-Transfer-Encoding: 8bit\n"
    1515"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"
    1717"X-Domain: admintosh"
     18
     19#: inc/Limit_Login_Attempts.php:122
     20#, php-format
     21msgid "%1$s %2$s attempts remaining.%3$s"
     22msgstr ""
    1823
    1924#: admin/Admin.php:147
     
    2126msgstr ""
    2227
    23 #: admin/Admin.php:392
     28#: admin/Admin.php:428
    2429msgid "Active Login Captcha"
    2530msgstr ""
    2631
    27 #: admin/Admin.php:400
     32#: admin/Admin.php:436
    2833msgid "Addition Captcha"
    2934msgstr ""
    3035
    31 #: admin/Admin.php:216
     36#: admin/Admin.php:234
    3237msgid "Admin Background Color"
    3338msgstr ""
     
    3742msgstr ""
    3843
    39 #: admin/Admin.php:220
     44#: admin/Admin.php:238
    4045msgid "Admin Menu Hover Background Color"
    4146msgstr ""
    4247
    43 #: admin/Admin.php:228
     48#: admin/Admin.php:246
    4449msgid "Admin Menu Hover Link Color"
    4550msgstr ""
    4651
    47 #: admin/Admin.php:224
     52#: admin/Admin.php:242
    4853msgid "Admin Menu Link Color"
    4954msgstr ""
    5055
    51 #: admin/Admin.php:232
     56#: admin/Admin.php:250
    5257msgid "Admin Sub Menu Background Color"
    5358msgstr ""
    5459
    55 #: admin/Admin.php:236
     60#: admin/Admin.php:254
    5661msgid "Admin Sub Menu Link Color"
    5762msgstr ""
     
    6166msgstr ""
    6267
    63 #: admin/Admin.php:171
     68#: admin/Admin.php:180
    6469msgid "Admin Top Bar Background Color"
    6570msgstr ""
    6671
    67 #: admin/Admin.php:179
     72#: admin/Admin.php:188
    6873msgid "Admin Top Bar Link Color"
    6974msgstr ""
    7075
    71 #: admin/Admin.php:183
     76#: admin/Admin.php:192
    7277msgid "Admin Top Bar Link Hover Background Color"
    7378msgstr ""
    7479
    75 #: admin/Admin.php:187
     80#: admin/Admin.php:196
    7681msgid "Admin Top Bar Link Hover Color"
    7782msgstr ""
    7883
    79 #: admin/Admin.php:191
     84#: admin/Admin.php:200
    8085msgid "Admin Top bar Logo"
    8186msgstr ""
    8287
    83 #: admin/Admin.php:175
     88#: admin/Admin.php:184
    8489msgid "Admin Top Bar Text Color"
    8590msgstr ""
     
    9499msgstr ""
    95100
    96 #: admin/Admin.php:257
     101#: admin/Admin.php:284
    97102msgid "Background Color"
    98103msgstr ""
    99104
    100 #: admin/Admin.php:262
     105#: admin/Admin.php:289
    101106msgid "Background Image"
    102107msgstr ""
    103108
    104 #: admin/Admin.php:321
     109#: admin/Admin.php:357
    105110msgid "Border"
    106111msgstr ""
    107112
    108 #: admin/Admin.php:359
     113#: admin/Admin.php:395
    109114msgid "Button Background Color"
    110115msgstr ""
    111116
    112 #: admin/Admin.php:367
     117#: admin/Admin.php:403
    113118msgid "Button Border Color"
    114119msgstr ""
    115120
    116 #: admin/Admin.php:371
     121#: admin/Admin.php:407
    117122msgid "Button Hover Background Color"
    118123msgstr ""
    119124
    120 #: admin/Admin.php:379
     125#: admin/Admin.php:415
    121126msgid "Button Hover Border Color"
    122127msgstr ""
    123128
    124 #: admin/Admin.php:375
     129#: admin/Admin.php:411
    125130msgid "Button Hover Text Color"
    126131msgstr ""
    127132
    128 #: admin/Admin.php:363
     133#: admin/Admin.php:399
    129134msgid "Button Text Color"
    130135msgstr ""
     
    138143msgstr ""
    139144
    140 #: admin/Admin.php:396
     145#: admin/Admin.php:432
    141146msgid "Captcha Type"
     147msgstr ""
     148
     149#: admin/Admin.php:170 admin/Admin.php:224 admin/Admin.php:274
     150#: admin/Admin.php:335
     151msgid "Color Preset"
    142152msgstr ""
    143153
     
    166176msgstr ""
    167177
    168 #: admin/Admin.php:430
     178#: admin/Admin.php:466
    169179msgid "Duration In Minute"
    170180msgstr ""
    171181
    172 #: admin/Admin.php:424
     182#: admin/Admin.php:460
    173183msgid "Failed Login Limit"
    174184msgstr ""
    175185
    176 #: admin/Admin.php:355
     186#: admin/Admin.php:391
    177187msgid "Form Button Style"
    178188msgstr ""
    179189
    180 #: admin/Admin.php:399
     190#: admin/Admin.php:435
    181191msgid "Google reCAPTCHA"
    182192msgstr ""
    183193
    184 #: admin/Admin.php:411
     194#: admin/Admin.php:447
    185195msgid "Google reCAPTCHA Secret key"
    186196msgstr ""
    187197
    188 #: admin/Admin.php:405
     198#: admin/Admin.php:441
    189199msgid "Google reCAPTCHA Site Key"
    190200msgstr ""
     
    202212msgstr ""
    203213
    204 #: admin/Admin.php:330
     214#: admin/Admin.php:366
    205215msgid "Input Field Background Color"
    206216msgstr ""
    207217
    208 #: admin/Admin.php:338
     218#: admin/Admin.php:374
    209219msgid "Input Field Border"
    210220msgstr ""
    211221
    212 #: admin/Admin.php:342
     222#: admin/Admin.php:378
    213223msgid "Input Field Padding"
    214224msgstr ""
    215225
    216 #: admin/Admin.php:334
     226#: admin/Admin.php:370
    217227msgid "Input Field Text Color"
    218228msgstr ""
    219229
    220 #: admin/Admin.php:326
     230#: admin/Admin.php:362
    221231msgid "Input Fields Style"
    222232msgstr ""
    223233
    224 #: admin/Admin.php:294
     234#: admin/Admin.php:321
    225235msgid "Link Color"
    226236msgstr ""
    227237
    228 #: admin/Admin.php:298
     238#: admin/Admin.php:325
    229239msgid "Link Hover Color"
    230240msgstr ""
     
    234244msgstr ""
    235245
    236 #: admin/Admin.php:429
     246#: admin/Admin.php:465
    237247msgid "Lockout Duration"
    238248msgstr ""
     
    242252msgstr ""
    243253
    244 #: admin/Admin.php:351
     254#: admin/Admin.php:387
    245255msgid "Login Button Margin"
    246256msgstr ""
    247257
    248 #: admin/Admin.php:347
     258#: admin/Admin.php:383
    249259msgid "Login Button Padding"
    250260msgstr ""
    251261
    252 #: admin/Admin.php:309
     262#: admin/Admin.php:345
    253263msgid "Login Form Background Color"
    254264msgstr ""
    255265
    256 #: admin/Admin.php:313
     266#: admin/Admin.php:349
    257267msgid "Login Form Background Image"
    258268msgstr ""
    259269
    260 #: admin/Admin.php:249
     270#: admin/Admin.php:267
    261271msgid "Login Form Style"
    262272msgstr ""
     
    270280msgstr ""
    271281
    272 #: admin/Admin.php:248
     282#: admin/Admin.php:266
    273283msgid "Login Page Style"
    274284msgstr ""
     
    278288msgstr ""
    279289
    280 #: admin/Admin.php:266
     290#: admin/Admin.php:293
    281291msgid "Logo"
    282292msgstr ""
    283293
    284 #: admin/Admin.php:200 admin/Admin.php:274
     294#: admin/Admin.php:209 admin/Admin.php:301
    285295msgid "Logo Height"
    286296msgstr ""
    287297
    288 #: admin/Admin.php:205
     298#: admin/Admin.php:214
    289299msgid "Logo Margin"
    290300msgstr ""
    291301
    292 #: admin/Admin.php:278
     302#: admin/Admin.php:305
    293303msgid "Logo Size"
    294304msgstr ""
    295305
    296 #: admin/Admin.php:195 admin/Admin.php:270
     306#: admin/Admin.php:204 admin/Admin.php:297
    297307msgid "Logo Width"
    298308msgstr ""
    299309
    300 #: admin/Admin.php:282
     310#: admin/Admin.php:309
    301311msgid "Logo/Site Name Margin Bottom"
    302312msgstr ""
     
    310320msgstr ""
    311321
    312 #: admin/Admin.php:401
     322#: admin/Admin.php:437
    313323msgid "Random Number Captcha"
    314324msgstr ""
    315325
    316 #: admin/Admin.php:407 admin/Admin.php:413
     326#: admin/Admin.php:443 admin/Admin.php:449
    317327#, php-format
    318328msgid ""
     
    324334msgstr ""
    325335
    326 #: admin/Admin.php:286
     336#: admin/Admin.php:313
    327337msgid "Site Name"
    328338msgstr ""
     
    332342msgstr ""
    333343
    334 #: admin/Admin.php:290 admin/Admin.php:317
     344#: admin/Admin.php:317 admin/Admin.php:353
    335345msgid "Text Color"
     346msgstr ""
     347
     348#: inc/Limit_Login_Attempts.php:51 inc/Limit_Login_Attempts.php:118
     349#, php-format
     350msgid "To many failed login attempts. Please login after %1$s"
    336351msgstr ""
    337352
  • admintosh/trunk/readme.txt

    r3022674 r3063121  
    44Tags: customize dashboard, customize admin menu, customize login page, security tools, captcha, recaptcha, admin menu, dashboard, admin bar, login page, customize admin
    55Requires PHP: 7.4
    6 Requires at least: 6.4.2
    7 Tested up to: 6.4.2
    8 Stable tag: 1.0.1
    9 Version: 1.0.1
     6Requires at least: 6.5
     7Tested up to: 6.5
     8Stable tag: 1.0.2
     9Version: 1.0.2
    1010License: GPLv2 or later
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8282== Changelog ==
    8383
     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
    8491= 1.0.1 =
    85 Added Limit Login Attempts Feature
    86 Fixed Session Conflict Issue
     92- Added Limit Login Attempts Feature
     93- Fixed Session Conflict Issue
    8794
    8895= 1.0.0 =
Note: See TracChangeset for help on using the changeset viewer.