Prevent nextcloud impersonate plugin to login #561

This commit is contained in:
the-djmaze 2022-10-31 14:56:42 +01:00
parent 6e4be76664
commit 1dbf2e909f
3 changed files with 14 additions and 3 deletions

View file

@ -106,9 +106,13 @@ class SnappyMailHelper
\RainLoop\Utils::SetCookie('smadmin', $sToken);
}
}
} else if (!$oActions->getMainAccountFromToken(false)) {
} else {
$aCredentials = SnappyMailHelper::getLoginCredentials();
if ($aCredentials[0] && $aCredentials[1]) {
if ($oActions->getMainAccountFromToken(false)) {
if (!$aCredentials[0] || !$aCredentials[1]) {
$oActions->Logout(true);
}
} else if ($aCredentials[0] && $aCredentials[1]) {
$oActions->Logger()->AddSecret($aCredentials[1]);
$oAccount = $oActions->LoginProcess($aCredentials[0], $aCredentials[1], false);
if ($oAccount) {
@ -143,6 +147,10 @@ class SnappyMailHelper
$sEmail = $config->getUserValue($sUID, 'settings', 'email', '');
$sPassword = \OC::$server->getSession()['snappymail-password'];
}
if (\OC::$server->getSession()['snappymail-email'] != $sEmail) {
$sPassword = '';
}
// 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', '');