diff --git a/integrations/nextcloud/snappymail/lib/Controller/FetchController.php b/integrations/nextcloud/snappymail/lib/Controller/FetchController.php index 25bc0254b..385710e91 100644 --- a/integrations/nextcloud/snappymail/lib/Controller/FetchController.php +++ b/integrations/nextcloud/snappymail/lib/Controller/FetchController.php @@ -105,14 +105,15 @@ class FetchController extends Controller { $sEmail = ''; if (isset($_POST['appname'], $_POST['snappymail-password'], $_POST['snappymail-email']) && 'snappymail' === $_POST['appname']) { $sUser = SnappyMailHelper::getUID(); + if ($sUser) { + $sEmail = $_POST['snappymail-email']; + $this->config->setUserValue($sUser, 'snappymail', 'snappymail-email', $sEmail); - $sEmail = $_POST['snappymail-email']; - $this->config->setUserValue($sUser, 'snappymail', 'snappymail-email', $sEmail); - - $sPass = $_POST['snappymail-password']; - if ('******' !== $sPass) { - $this->config->setUserValue($sUser, 'snappymail', 'passphrase', - $sPass ? SnappyMailHelper::encodePassword($sPass, \md5($sEmail)) : ''); + $sPass = $_POST['snappymail-password']; + if ('******' !== $sPass) { + $this->config->setUserValue($sUser, 'snappymail', 'passphrase', + $sPass ? SnappyMailHelper::encodePassword($sPass, \md5($sEmail)) : ''); + } } } else { return new JSONResponse([