Improved login handling for Nextcloud #96

This commit is contained in:
the-djmaze 2022-10-13 23:46:37 +02:00
parent 00b08260e9
commit c5d1e5e9c6
4 changed files with 25 additions and 7 deletions

View file

@ -143,6 +143,23 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
'WebDAV' => $sWebDAV
// 'WebDAV_files' => $sWebDAV . '/files/' . $sUID
];
if (empty($aResult['Auth'])) {
$config = \OC::$server->getConfig();
// Only store the user's password in the current session if they have
// enabled auto-login using Nextcloud username or email address.
if ($config->getAppValue('snappymail', 'snappymail-autologin', false)) {
$sEmail = $sUID;
} else if ($config->getAppValue('snappymail', 'snappymail-autologin-with-email', false)) {
$sEmail = $config->getUserValue($sUID, 'settings', 'email', '');
}
// If the user has set credentials for SnappyMail in their personal
// settings, override everything before and use those instead.
$sCustomEmail = $config->getUserValue($sUID, 'snappymail', 'snappymail-email', '');
if ($sCustomEmail) {
$sEmail = $sCustomEmail;
}
$aResult['DevEmail'] = $sEmail ?: '';
}
}
}