From 67d852db7f92aac801e066198cb5446193595dde Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 25 Jun 2024 19:48:18 +0530 Subject: [PATCH 1/3] remove autologin for sso --- lib/Listeners/BeforeTemplateRenderedListener.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/Listeners/BeforeTemplateRenderedListener.php b/lib/Listeners/BeforeTemplateRenderedListener.php index adece9c3..cf8d7410 100644 --- a/lib/Listeners/BeforeTemplateRenderedListener.php +++ b/lib/Listeners/BeforeTemplateRenderedListener.php @@ -65,13 +65,6 @@ class BeforeTemplateRenderedListener implements IEventListener { return; } - // Just send over '1' as password to trigger login as the plugin will set the correct access token - $password = self::SNAPPYMAIL_AUTOLOGIN_PWD; // As we cannot pass by reference to LoginProcess - $account = $actions->LoginProcess($accountId, $password, false); - if ($account) { - $actions->Plugins()->RunHook('login.success', array($account)); - $actions->SetAuthToken($account); - } } private function getAccountId(): string { -- GitLab From f23d72858203280cede3746323aba2ee9313f10a Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 25 Jun 2024 19:48:22 +0530 Subject: [PATCH 2/3] remove autologin for sso --- .../BeforeTemplateRenderedListener.php | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/lib/Listeners/BeforeTemplateRenderedListener.php b/lib/Listeners/BeforeTemplateRenderedListener.php index cf8d7410..b7aeb661 100644 --- a/lib/Listeners/BeforeTemplateRenderedListener.php +++ b/lib/Listeners/BeforeTemplateRenderedListener.php @@ -23,9 +23,6 @@ class BeforeTemplateRenderedListener implements IEventListener { private $appManager; private Util $util; - private const SNAPPYMAIL_APP_ID = 'snappymail'; - private const SNAPPYMAIL_URL = '/apps/snappymail/'; - private const SNAPPYMAIL_AUTOLOGIN_PWD = '1'; public function __construct($appName, IUserSession $userSession, IRequest $request, ISession $session, IConfig $config, IAppManager $appManager, Util $util) { $this->appName = $appName; @@ -41,9 +38,7 @@ class BeforeTemplateRenderedListener implements IEventListener { if (!($event instanceof BeforeTemplateRenderedEvent)) { return; } - if ($this->userSession->isLoggedIn() && $this->appManager->isEnabledForUser(self::SNAPPYMAIL_APP_ID) && strpos($this->request->getPathInfo(), self::SNAPPYMAIL_URL) !== false) { - $this->autoLoginWebmail(); - } + $pathInfo = $this->request->getPathInfo(); if (strpos($pathInfo, '/apps/ecloud-accounts/accounts') !== false) { @@ -52,21 +47,6 @@ class BeforeTemplateRenderedListener implements IEventListener { } - - private function autoLoginWebmail() { - $isOidcLogin = $this->session->get('is_oidc'); - if (!$isOidcLogin) { - return; - } - $accountId = $this->getAccountId(); - $actions = \RainLoop\Api::Actions(); - - if (empty($accountId) || $actions->getMainAccountFromToken(false)) { - return; - } - - } - private function getAccountId(): string { $username = $this->userSession->getUser()->getUID(); if ($this->config->getAppValue('snappymail', 'snappymail-autologin', false)) { -- GitLab From 6211b1d98c8afb73969094e0d050039a5fd111a0 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 25 Jun 2024 21:41:55 +0530 Subject: [PATCH 3/3] remove function getAccountId --- lib/Listeners/BeforeTemplateRenderedListener.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/Listeners/BeforeTemplateRenderedListener.php b/lib/Listeners/BeforeTemplateRenderedListener.php index b7aeb661..d124d813 100644 --- a/lib/Listeners/BeforeTemplateRenderedListener.php +++ b/lib/Listeners/BeforeTemplateRenderedListener.php @@ -46,14 +46,4 @@ class BeforeTemplateRenderedListener implements IEventListener { } } - - private function getAccountId(): string { - $username = $this->userSession->getUser()->getUID(); - if ($this->config->getAppValue('snappymail', 'snappymail-autologin', false)) { - return $username; - } - if ($this->config->getAppValue('snappymail', 'snappymail-autologin-with-email', false)) { - return $this->config->getUserValue($username, 'settings', 'email', ''); - } - } } -- GitLab