From 50265b3b3794f820d35c07c70f6cb9b297f561b0 Mon Sep 17 00:00:00 2001 From: Akhil Date: Thu, 8 Aug 2024 22:09:34 +0530 Subject: [PATCH] Also perform logout if explicit creds change --- .../snappymail/lib/Controller/FetchController.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/integrations/nextcloud/snappymail/lib/Controller/FetchController.php b/integrations/nextcloud/snappymail/lib/Controller/FetchController.php index af0dcd8fd..2b33ad945 100644 --- a/integrations/nextcloud/snappymail/lib/Controller/FetchController.php +++ b/integrations/nextcloud/snappymail/lib/Controller/FetchController.php @@ -119,12 +119,21 @@ class FetchController extends Controller { ]); } + // Logout as the credentials have changed + SnappyMailHelper::loadApp(); + \RainLoop\Api::Actions()->DoLogout(); + return new JSONResponse([ 'status' => 'success', 'Message' => $this->l->t('Saved successfully'), 'Email' => $sEmail ]); } catch (Exception $e) { + // Logout as the credentials might have changed, as exception could be in one attribute + // TODO: Handle both exceptions separately? + SnappyMailHelper::loadApp(); + \RainLoop\Api::Actions()->DoLogout(); + return new JSONResponse([ 'status' => 'error', 'Message' => $e->getMessage()