From 12398086a5e587fdd8776c37696478d80d25b6af Mon Sep 17 00:00:00 2001 From: aB0t Date: Mon, 7 Aug 2023 14:39:29 +0200 Subject: [PATCH] update 2023-08-07 14:39:29 --- src/36ab759f-7b42-4465-9c17-56ba1dd05f90/code.php | 14 +++++++++++++- .../code.power | 14 +++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/36ab759f-7b42-4465-9c17-56ba1dd05f90/code.php b/src/36ab759f-7b42-4465-9c17-56ba1dd05f90/code.php index 324d9f3..9a94bed 100644 --- a/src/36ab759f-7b42-4465-9c17-56ba1dd05f90/code.php +++ b/src/36ab759f-7b42-4465-9c17-56ba1dd05f90/code.php @@ -376,6 +376,18 @@ final class Linker ]; } + // get trying attempt counter + $attempt = $this->session->get("getbible_attempt_{$linker}", 1); + if ($attempt >= 11) + { + return [ + 'error' => Text::_('COM_GETBIBLE_YOU_HAVE_BEEN_BLOCKED_YOU_WILL_NEED_TO_WAIT_ONE_DAY_BEFORE_TRYING_AGAIN_OR_CONTACT_SUPPORT') + ]; + } + // we log this, only 10 allowed + $attempt++; + $this->session->set("getbible_attempt_{$linker}", $attempt); + // get linker if (($_linker = $this->load->item(['guid' => $linker],'linker')) !== null) { @@ -389,7 +401,6 @@ final class Linker if (!empty($oldPass)) { - $oldPass = trim($oldPass); if (($guid = $this->getPassGuid($linker, $oldPass)) === null) @@ -439,6 +450,7 @@ final class Linker // add to session $this->session->set('getbible_active_linker_guid', $linker); $this->session->set("getbible_active_{$linker}", 'valid_access'); + $this->session->set("getbible_attempt_{$linker}", 1); return (array) $_linker; } diff --git a/src/36ab759f-7b42-4465-9c17-56ba1dd05f90/code.power b/src/36ab759f-7b42-4465-9c17-56ba1dd05f90/code.power index 1244120..9a17545 100644 --- a/src/36ab759f-7b42-4465-9c17-56ba1dd05f90/code.power +++ b/src/36ab759f-7b42-4465-9c17-56ba1dd05f90/code.power @@ -346,6 +346,18 @@ ]; } + // get trying attempt counter + $attempt = $this->session->get("getbible_attempt_{$linker}", 1); + if ($attempt >= 11) + { + return [ + 'error' => Text::_('You have been blocked, you will need to wait one day before trying again, or contact support.') + ]; + } + // we log this, only 10 allowed + $attempt++; + $this->session->set("getbible_attempt_{$linker}", $attempt); + // get linker if (($_linker = $this->load->item(['guid' => $linker],'linker')) !== null) { @@ -359,7 +371,6 @@ if (!empty($oldPass)) { - $oldPass = trim($oldPass); if (($guid = $this->getPassGuid($linker, $oldPass)) === null) @@ -409,6 +420,7 @@ // add to session $this->session->set('getbible_active_linker_guid', $linker); $this->session->set("getbible_active_{$linker}", 'valid_access'); + $this->session->set("getbible_attempt_{$linker}", 1); return (array) $_linker; }