From b77cba845475c0ef33746b747cf5a7c767607599 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Wed, 14 Feb 2024 18:23:17 +0530 Subject: [PATCH 1/7] hide banner --- scss/email-recovery.scss | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scss/email-recovery.scss b/scss/email-recovery.scss index aa010b6..9fd6cd5 100644 --- a/scss/email-recovery.scss +++ b/scss/email-recovery.scss @@ -54,3 +54,6 @@ font-weight: bold; width: fit-content; } +#body-login .recovery-email-banner { + display: none; +} \ No newline at end of file -- GitLab From c23d6b3d6cffbe717d9852722931c4c81a755709 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Wed, 14 Feb 2024 18:24:09 +0530 Subject: [PATCH 2/7] hide banner --- scss/email-recovery.scss | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scss/email-recovery.scss b/scss/email-recovery.scss index 9fd6cd5..290391e 100644 --- a/scss/email-recovery.scss +++ b/scss/email-recovery.scss @@ -34,7 +34,14 @@ } +#body-login .recovery-email-banner { + display: none; +} + @media only screen and (max-width: 768px) { + #body-login .recovery-email-banner { + display: none; + } .recovery-email-banner { display: block; a{ @@ -54,6 +61,3 @@ font-weight: bold; width: fit-content; } -#body-login .recovery-email-banner { - display: none; -} \ No newline at end of file -- GitLab From 7f3260ff98711186a00492674709ee8a9d218cac Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Mon, 19 Feb 2024 14:20:32 +0530 Subject: [PATCH 3/7] removed css change --- scss/email-recovery.scss | 7 ------- 1 file changed, 7 deletions(-) diff --git a/scss/email-recovery.scss b/scss/email-recovery.scss index 290391e..aa010b6 100644 --- a/scss/email-recovery.scss +++ b/scss/email-recovery.scss @@ -34,14 +34,7 @@ } -#body-login .recovery-email-banner { - display: none; -} - @media only screen and (max-width: 768px) { - #body-login .recovery-email-banner { - display: none; - } .recovery-email-banner { display: block; a{ -- GitLab From 61a4ebd0e25faad26673a79920ff084005b9e4e5 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Mon, 19 Feb 2024 14:27:06 +0530 Subject: [PATCH 4/7] added Render As --- lib/Listeners/BeforeTemplateRenderedListener.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/Listeners/BeforeTemplateRenderedListener.php b/lib/Listeners/BeforeTemplateRenderedListener.php index 5dee093..2386bf7 100644 --- a/lib/Listeners/BeforeTemplateRenderedListener.php +++ b/lib/Listeners/BeforeTemplateRenderedListener.php @@ -31,11 +31,13 @@ class BeforeTemplateRenderedListener implements IEventListener { if (!($event instanceof BeforeTemplateRenderedEvent)) { return; } - if ($this->userSession->isLoggedIn() && !empty($this->userId)) { - $recoveryEmail = $this->recoveryEmailService->getRecoveryEmail($this->userId); - if ($recoveryEmail === '') { - $this->util->addStyle($this->appName, 'email-recovery'); - $this->util->addScript($this->appName, $this->appName . '-email-recovery'); + if ($event->getResponse()->getRenderAs() === TemplateResponse::RENDER_AS_USER) { + if ($this->userSession->isLoggedIn() && !empty($this->userId)) { + $recoveryEmail = $this->recoveryEmailService->getRecoveryEmail($this->userId); + if ($recoveryEmail === '') { + $this->util->addStyle($this->appName, 'email-recovery'); + $this->util->addScript($this->appName, $this->appName . '-email-recovery'); + } } } } -- GitLab From 79140ac3487cbff0e1de22cc1efd5514d6942129 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Mon, 19 Feb 2024 14:33:17 +0530 Subject: [PATCH 5/7] added Render As --- lib/Listeners/BeforeTemplateRenderedListener.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Listeners/BeforeTemplateRenderedListener.php b/lib/Listeners/BeforeTemplateRenderedListener.php index 2386bf7..819b8f5 100644 --- a/lib/Listeners/BeforeTemplateRenderedListener.php +++ b/lib/Listeners/BeforeTemplateRenderedListener.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace OCA\EmailRecovery\Listeners; use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent; +use OCP\AppFramework\Http\TemplateResponse; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; use OCP\IUserSession; -- GitLab From 6a5e877fd7bf1310f1f687f1d1d3aae8e01672ab Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Mon, 19 Feb 2024 18:09:59 +0530 Subject: [PATCH 6/7] remove nesting --- lib/Listeners/BeforeTemplateRenderedListener.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/Listeners/BeforeTemplateRenderedListener.php b/lib/Listeners/BeforeTemplateRenderedListener.php index 819b8f5..6ed5687 100644 --- a/lib/Listeners/BeforeTemplateRenderedListener.php +++ b/lib/Listeners/BeforeTemplateRenderedListener.php @@ -32,13 +32,11 @@ class BeforeTemplateRenderedListener implements IEventListener { if (!($event instanceof BeforeTemplateRenderedEvent)) { return; } - if ($event->getResponse()->getRenderAs() === TemplateResponse::RENDER_AS_USER) { - if ($this->userSession->isLoggedIn() && !empty($this->userId)) { - $recoveryEmail = $this->recoveryEmailService->getRecoveryEmail($this->userId); - if ($recoveryEmail === '') { - $this->util->addStyle($this->appName, 'email-recovery'); - $this->util->addScript($this->appName, $this->appName . '-email-recovery'); - } + if (($event->getResponse()->getRenderAs() === TemplateResponse::RENDER_AS_USER) && $this->userSession->isLoggedIn() && !empty($this->userId)) { + $recoveryEmail = $this->recoveryEmailService->getRecoveryEmail($this->userId); + if ($recoveryEmail === '') { + $this->util->addStyle($this->appName, 'email-recovery'); + $this->util->addScript($this->appName, $this->appName . '-email-recovery'); } } } -- GitLab From a5f4435e128758de8e17f702a6c8d33a6ac34174 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 20 Feb 2024 16:16:07 +0530 Subject: [PATCH 7/7] isLoggedIn added --- lib/Listeners/BeforeTemplateRenderedListener.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/Listeners/BeforeTemplateRenderedListener.php b/lib/Listeners/BeforeTemplateRenderedListener.php index 6ed5687..63fb7e9 100644 --- a/lib/Listeners/BeforeTemplateRenderedListener.php +++ b/lib/Listeners/BeforeTemplateRenderedListener.php @@ -8,7 +8,6 @@ use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent; use OCP\AppFramework\Http\TemplateResponse; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; -use OCP\IUserSession; use OCP\Util; use OCA\EmailRecovery\Service\RecoveryEmailService; @@ -20,10 +19,9 @@ class BeforeTemplateRenderedListener implements IEventListener { private $userId; - public function __construct($appName, $userId, IUserSession $userSession, Util $util, RecoveryEmailService $recoveryEmailService) { + public function __construct($appName, $userId, Util $util, RecoveryEmailService $recoveryEmailService) { $this->appName = $appName; $this->userId = $userId; - $this->userSession = $userSession; $this->util = $util; $this->recoveryEmailService = $recoveryEmailService; } @@ -32,7 +30,7 @@ class BeforeTemplateRenderedListener implements IEventListener { if (!($event instanceof BeforeTemplateRenderedEvent)) { return; } - if (($event->getResponse()->getRenderAs() === TemplateResponse::RENDER_AS_USER) && $this->userSession->isLoggedIn() && !empty($this->userId)) { + if (($event->getResponse()->getRenderAs() === TemplateResponse::RENDER_AS_USER) && $event->isLoggedIn() && !empty($this->userId)) { $recoveryEmail = $this->recoveryEmailService->getRecoveryEmail($this->userId); if ($recoveryEmail === '') { $this->util->addStyle($this->appName, 'email-recovery'); -- GitLab