From 7b6dd5bf51bc2ecd33a00859c3a454e0da7d5772 Mon Sep 17 00:00:00 2001 From: Aselsan Date: Mon, 26 Aug 2024 14:27:31 +0700 Subject: [PATCH 1/4] Update HmacAuth.php --- src/Filters/HmacAuth.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Filters/HmacAuth.php b/src/Filters/HmacAuth.php index fd2123c04..37d1ae991 100644 --- a/src/Filters/HmacAuth.php +++ b/src/Filters/HmacAuth.php @@ -45,10 +45,6 @@ public function before(RequestInterface $request, $arguments = null) ->setJSON(['message' => lang('Auth.badToken')]); } - if (setting('Auth.recordActiveDate')) { - $authenticator->recordActiveDate(); - } - // Block inactive users when Email Activation is enabled $user = $authenticator->getUser(); if ($user !== null && ! $user->isActivated()) { @@ -59,6 +55,10 @@ public function before(RequestInterface $request, $arguments = null) ->setJSON(['message' => lang('Auth.activationBlocked')]); } + if (setting('Auth.recordActiveDate')) { + $authenticator->recordActiveDate(); + } + return $request; } From 3bbe65ef92ca3e1688f528fded5574aa6d562c97 Mon Sep 17 00:00:00 2001 From: Aselsan Date: Mon, 26 Aug 2024 14:28:27 +0700 Subject: [PATCH 2/4] Update SessionAuth.php --- src/Filters/SessionAuth.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Filters/SessionAuth.php b/src/Filters/SessionAuth.php index 2063f240d..2a3f87e0a 100644 --- a/src/Filters/SessionAuth.php +++ b/src/Filters/SessionAuth.php @@ -52,10 +52,6 @@ public function before(RequestInterface $request, $arguments = null) $authenticator = auth('session')->getAuthenticator(); if ($authenticator->loggedIn()) { - if (setting('Auth.recordActiveDate')) { - $authenticator->recordActiveDate(); - } - // Block inactive users when Email Activation is enabled $user = $authenticator->getUser(); @@ -76,6 +72,10 @@ public function before(RequestInterface $request, $arguments = null) } } + if (setting('Auth.recordActiveDate')) { + $authenticator->recordActiveDate(); + } + return; } From a4d067ab6a548c61d31da684bd6da7d0feedcc4e Mon Sep 17 00:00:00 2001 From: Aselsan Date: Mon, 26 Aug 2024 14:29:53 +0700 Subject: [PATCH 3/4] Update TokenAuth.php --- src/Filters/TokenAuth.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Filters/TokenAuth.php b/src/Filters/TokenAuth.php index 473d5cc8d..a5230b774 100644 --- a/src/Filters/TokenAuth.php +++ b/src/Filters/TokenAuth.php @@ -61,10 +61,6 @@ public function before(RequestInterface $request, $arguments = null) ->setJSON(['message' => lang('Auth.badToken')]); } - if (setting('Auth.recordActiveDate')) { - $authenticator->recordActiveDate(); - } - // Block inactive users when Email Activation is enabled $user = $authenticator->getUser(); if ($user !== null && ! $user->isActivated()) { @@ -74,6 +70,10 @@ public function before(RequestInterface $request, $arguments = null) ->setStatusCode(Response::HTTP_FORBIDDEN) ->setJSON(['message' => lang('Auth.activationBlocked')]); } + + if (setting('Auth.recordActiveDate')) { + $authenticator->recordActiveDate(); + } } /** From 0f4051182f54b9aeee28afbf60ba56e62938a640 Mon Sep 17 00:00:00 2001 From: Aselsan Date: Mon, 26 Aug 2024 14:46:04 +0700 Subject: [PATCH 4/4] update docs --- src/Config/Auth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Config/Auth.php b/src/Config/Auth.php index 9df36cd77..d938cb46c 100644 --- a/src/Config/Auth.php +++ b/src/Config/Auth.php @@ -159,7 +159,7 @@ class Auth extends BaseConfig * Record Last Active Date * -------------------------------------------------------------------- * If true, will always update the `last_active` datetime for the - * logged-in user on every page request. + * logged-in user on every page request, provided the user is activated and not banned. * This feature only works when session/tokens/hmac/chain/jwt filter is active. * * @see https://codeigniter4.github.io/shield/quick_start_guide/using_session_auth/#protecting-pages for set filters.