8
8
* License: GNU/GPLv2
9
9
* @see LICENSE.txt
10
10
*
11
- * This file: Front-end handler (last modified: 2022.02.01 ).
11
+ * This file: Front-end handler (last modified: 2022.02.13 ).
12
12
*/
13
13
14
14
namespace phpMussel \FrontEnd ;
@@ -222,10 +222,10 @@ public function view(string $Page = ''): void
222
222
{
223
223
/** Brute-force protection. */
224
224
if ((
225
- ($ LoginAttempts = (int )$ this ->Loader ->Cache ->getEntry ('LoginAttempts ' . $ this ->IPAddr )) &&
225
+ ($ LoginAttempts = (int )$ this ->Loader ->Cache ->getEntry ('LoginAttempts ' . $ this ->Loader -> IPAddr )) &&
226
226
($ LoginAttempts >= $ this ->Loader ->Configuration ['frontend ' ]['max_login_attempts ' ])
227
227
) || (
228
- ($ Failed2FA = (int )$ this ->Loader ->Cache ->getEntry ('Failed2FA ' . $ this ->IPAddr )) &&
228
+ ($ Failed2FA = (int )$ this ->Loader ->Cache ->getEntry ('Failed2FA ' . $ this ->Loader -> IPAddr )) &&
229
229
($ Failed2FA >= $ this ->Loader ->Configuration ['frontend ' ]['max_login_attempts ' ])
230
230
)) {
231
231
header ('Content-Type: text/plain ' );
@@ -297,7 +297,7 @@ public function view(string $Page = ''): void
297
297
'UA ' => $ _SERVER ['HTTP_USER_AGENT ' ] ?? '' ,
298
298
299
299
/** The IP address of the current request. */
300
- 'YourIP ' => $ this ->IPAddr ,
300
+ 'YourIP ' => $ this ->Loader -> IPAddr ,
301
301
302
302
/** Asynchronous mode. */
303
303
'ASYNC ' => !empty ($ _POST ['ASYNC ' ]),
@@ -455,7 +455,7 @@ public function view(string $Page = ''): void
455
455
!empty ($ this ->Loader ->Configuration [$ ConfigUserPath ]['permissions ' ])
456
456
) {
457
457
if (password_verify ($ _POST ['password ' ], $ this ->Loader ->Configuration [$ ConfigUserPath ]['password ' ])) {
458
- $ this ->Loader ->Cache ->deleteEntry ('LoginAttempts ' . $ this ->IPAddr );
458
+ $ this ->Loader ->Cache ->deleteEntry ('LoginAttempts ' . $ this ->Loader -> IPAddr );
459
459
$ Permissions = (int )$ this ->Loader ->Configuration [$ ConfigUserPath ]['permissions ' ];
460
460
if ($ Permissions !== 1 && $ Permissions !== 2 ) {
461
461
$ FE ['state_msg ' ] = $ this ->Loader ->L10N ->getString ('response_login_wrong_endpoint ' );
@@ -512,7 +512,7 @@ public function view(string $Page = ''): void
512
512
if ($ FE ['state_msg ' ]) {
513
513
$ LoginAttempts ++;
514
514
$ TimeToAdd = ($ LoginAttempts > 4 ) ? ($ LoginAttempts - 4 ) * 86400 : 86400 ;
515
- $ this ->Loader ->Cache ->setEntry ('LoginAttempts ' . $ this ->IPAddr , $ LoginAttempts , $ TimeToAdd ?: 86400 );
515
+ $ this ->Loader ->Cache ->setEntry ('LoginAttempts ' . $ this ->Loader -> IPAddr , $ LoginAttempts , $ TimeToAdd ?: 86400 );
516
516
$ LoggerMessage = $ FE ['state_msg ' ];
517
517
}
518
518
} elseif ($ this ->Permissions === 3 ) {
@@ -526,7 +526,7 @@ public function view(string $Page = ''): void
526
526
$ TryUser = preg_replace ('~[\x00-\x1F]~ ' , '' , $ TryUser ?? $ this ->User );
527
527
528
528
/** Handle front-end logging. */
529
- $ this ->frontendLogger ($ this ->IPAddr , $ TryUser , $ LoggerMessage ?? '' );
529
+ $ this ->frontendLogger ($ this ->Loader -> IPAddr , $ TryUser , $ LoggerMessage ?? '' );
530
530
}
531
531
532
532
/** Determine whether the user has logged in. */
@@ -561,16 +561,16 @@ public function view(string $Page = ''): void
561
561
if (password_verify ($ _POST ['2fa ' ], substr ($ TwoFactorState , 1 ))) {
562
562
$ this ->Loader ->Cache ->setEntry ('TwoFactorState: ' . $ _COOKIE ['PHPMUSSEL-ADMIN ' ], '1 ' , $ this ->SessionTTL );
563
563
$ Try = 1 ;
564
- $ this ->Loader ->Cache ->deleteEntry ('Failed2FA ' . $ this ->IPAddr );
564
+ $ this ->Loader ->Cache ->deleteEntry ('Failed2FA ' . $ this ->Loader -> IPAddr );
565
565
if ($ this ->Loader ->Configuration ['frontend ' ]['frontend_log ' ]) {
566
- $ this ->frontendLogger ($ this ->IPAddr , $ SessionUser , $ this ->Loader ->L10N ->getString ('response_2fa_valid ' ));
566
+ $ this ->frontendLogger ($ this ->Loader -> IPAddr , $ SessionUser , $ this ->Loader ->L10N ->getString ('response_2fa_valid ' ));
567
567
}
568
568
} else {
569
569
$ Failed2FA ++;
570
570
$ TimeToAdd = ($ Failed2FA > 4 ) ? ($ Failed2FA - 4 ) * 86400 : 86400 ;
571
- $ this ->Loader ->Cache ->setEntry ('Failed2FA ' . $ this ->IPAddr , $ Failed2FA , $ TimeToAdd ?: 86400 );
571
+ $ this ->Loader ->Cache ->setEntry ('Failed2FA ' . $ this ->Loader -> IPAddr , $ Failed2FA , $ TimeToAdd ?: 86400 );
572
572
if ($ this ->Loader ->Configuration ['frontend ' ]['frontend_log ' ]) {
573
- $ this ->frontendLogger ($ this ->IPAddr , $ SessionUser , $ this ->Loader ->L10N ->getString ('response_2fa_invalid ' ));
573
+ $ this ->frontendLogger ($ this ->Loader -> IPAddr , $ SessionUser , $ this ->Loader ->L10N ->getString ('response_2fa_invalid ' ));
574
574
}
575
575
$ FE ['state_msg ' ] = $ this ->Loader ->L10N ->getString ('response_2fa_invalid ' );
576
576
}
@@ -605,7 +605,7 @@ public function view(string $Page = ''): void
605
605
$ this ->User = '' ;
606
606
$ this ->Permissions = 0 ;
607
607
setcookie ('PHPMUSSEL-ADMIN ' , '' , -1 , '/ ' , $ this ->HostnameOverride ?: $ this ->Host , false , true );
608
- $ this ->frontendLogger ($ this ->IPAddr , $ SessionUser , $ this ->Loader ->L10N ->getString ('state_logged_out ' ));
608
+ $ this ->frontendLogger ($ this ->Loader -> IPAddr , $ SessionUser , $ this ->Loader ->L10N ->getString ('state_logged_out ' ));
609
609
}
610
610
611
611
if ($ this ->Permissions === 1 ) {
0 commit comments