mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-10 09:02:45 +08:00
Disable Nextcloud Impersonate check #561
This commit is contained in:
parent
d3b65afb35
commit
7c362879ed
2 changed files with 7 additions and 8 deletions
|
@ -24,7 +24,6 @@ class PageController extends Controller
|
|||
$bAdmin = \RainLoop\Api::Config()->Get('security', 'admin_panel_key', 'admin') == $_SERVER['QUERY_STRING'];
|
||||
if (!$bAdmin) {
|
||||
SnappyMailHelper::startApp(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,7 +57,6 @@ class PageController extends Controller
|
|||
public function appGet()
|
||||
{
|
||||
SnappyMailHelper::startApp(true);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -103,26 +103,27 @@ class SnappyMailHelper
|
|||
} else {
|
||||
$doLogin = !$oActions->getMainAccountFromToken(false);
|
||||
$aCredentials = static::getLoginCredentials();
|
||||
/*
|
||||
// https://github.com/the-djmaze/snappymail/issues/561#issuecomment-1301317723
|
||||
// https://github.com/nextcloud/server/issues/34935#issuecomment-1302145157
|
||||
// $ocSession['snappymail-uid'] Always NULL, so we use a cookie
|
||||
// $ocSession = \OC::$server->getSession();
|
||||
// if (!$doLogin && $ocSession['snappymail-uid'] && $ocSession['snappymail-uid'] != $aCredentials[0]) {
|
||||
if (!$doLogin && !empty($_COOKIE['snappymail-uid']) && $_COOKIE['snappymail-uid'] != $aCredentials[0]) {
|
||||
if (!$doLogin && !empty($_COOKIE['sm-nc-uid']) && $_COOKIE['sm-nc-uid'] != $aCredentials[0]) {
|
||||
// UID changed, Impersonate plugin probably active
|
||||
\setcookie('snappymail-uid');
|
||||
\RainLoop\Utils::ClearCookie('sm-nc-uid');
|
||||
$oActions->Logout(true);
|
||||
$doLogin = true;
|
||||
// $this->logger->warning("Logout {$_COOKIE['snappymail-uid']}", ['app' => 'SnappyMail']);
|
||||
}
|
||||
// $ocSession['snappymail-uid'] = $aCredentials[0];
|
||||
\setcookie('snappymail-uid', $aCredentials[0]);
|
||||
// $ocSession->set('snappymail-uid', $aCredentials[0]);
|
||||
\RainLoop\Utils::SetCookie('snappymail-uid', $aCredentials[0]);
|
||||
*/
|
||||
if ($doLogin && $aCredentials[1] && $aCredentials[2]) {
|
||||
$oActions->Logger()->AddSecret($aCredentials[2]);
|
||||
$oAccount = $oActions->LoginProcess($aCredentials[1], $aCredentials[2], false);
|
||||
if ($oAccount) {
|
||||
$oActions->Plugins()->RunHook('login.success', array($oAccount));
|
||||
$oActions->SetAuthToken($oAccount);
|
||||
// $this->logger->warning("Login {$aCredentials[0]}", ['app' => 'SnappyMail']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue