mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-10-18 09:36:59 +08:00
Hopefully solved Nextcloud login issues #1602
This commit is contained in:
parent
68218e43dc
commit
047fd62ceb
1 changed files with 10 additions and 10 deletions
|
@ -4,7 +4,7 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
{
|
{
|
||||||
const
|
const
|
||||||
NAME = 'Nextcloud',
|
NAME = 'Nextcloud',
|
||||||
VERSION = '2.36.1',
|
VERSION = '2.36.2',
|
||||||
RELEASE = '2024-05-27',
|
RELEASE = '2024-05-27',
|
||||||
CATEGORY = 'Integrations',
|
CATEGORY = 'Integrations',
|
||||||
DESCRIPTION = 'Integrate with Nextcloud v20+',
|
DESCRIPTION = 'Integrate with Nextcloud v20+',
|
||||||
|
@ -36,12 +36,11 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
$this->addTemplate('templates/PopupsNextcloudFiles.html');
|
$this->addTemplate('templates/PopupsNextcloudFiles.html');
|
||||||
$this->addTemplate('templates/PopupsNextcloudCalendars.html');
|
$this->addTemplate('templates/PopupsNextcloudCalendars.html');
|
||||||
|
|
||||||
$this->addHook('login.credentials.step-2', 'loginCredentials2');
|
// $this->addHook('login.credentials.step-2', 'loginCredentials2');
|
||||||
$this->addHook('login.credentials', 'loginCredentials');
|
// $this->addHook('login.credentials', 'loginCredentials');
|
||||||
$this->addHook('imap.before-login', 'beforeLogin');
|
$this->addHook('imap.before-login', 'beforeLogin');
|
||||||
$this->addHook('smtp.before-login', 'beforeLogin');
|
$this->addHook('smtp.before-login', 'beforeLogin');
|
||||||
$this->addHook('sieve.before-login', 'beforeLogin');
|
$this->addHook('sieve.before-login', 'beforeLogin');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
\SnappyMail\Log::debug('Nextcloud', 'NOT integrated');
|
\SnappyMail\Log::debug('Nextcloud', 'NOT integrated');
|
||||||
// \OC::$server->getConfig()->getAppValue('snappymail', 'snappymail-no-embed');
|
// \OC::$server->getConfig()->getAppValue('snappymail', 'snappymail-no-embed');
|
||||||
|
@ -73,9 +72,13 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
|
|
||||||
public function loginCredentials(string &$sEmail, string &$sLogin, ?string &$sPassword = null) : void
|
public function loginCredentials(string &$sEmail, string &$sLogin, ?string &$sPassword = null) : void
|
||||||
{
|
{
|
||||||
$ocUser = \OC::$server->getUserSession()->getUser();
|
/**
|
||||||
$sEmail = $ocUser->getEMailAddress() ?: $ocUser->getPrimaryEMailAddress() ?: $sEmail;
|
* This has an issue.
|
||||||
$sLogin = $ocUser->getUID();
|
* When user changes email address, all settings are gone as the new
|
||||||
|
* _data_/_default_/storage/{domain}/{local-part} is used
|
||||||
|
*/
|
||||||
|
// $ocUser = \OC::$server->getUserSession()->getUser();
|
||||||
|
// $sEmail = $ocUser->getEMailAddress() ?: $ocUser->getPrimaryEMailAddress() ?: $sEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function loginCredentials2(string &$sEmail, ?string &$sPassword = null) : void
|
public function loginCredentials2(string &$sEmail, ?string &$sPassword = null) : void
|
||||||
|
@ -86,8 +89,6 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
|
|
||||||
public function beforeLogin(\RainLoop\Model\Account $oAccount, \MailSo\Net\NetClient $oClient, \MailSo\Net\ConnectSettings $oSettings) : void
|
public function beforeLogin(\RainLoop\Model\Account $oAccount, \MailSo\Net\NetClient $oClient, \MailSo\Net\ConnectSettings $oSettings) : void
|
||||||
{
|
{
|
||||||
$oSettings->username = \OC::$server->getUserSession()->getUser()->getUID();
|
|
||||||
|
|
||||||
// https://apps.nextcloud.com/apps/oidc_login
|
// https://apps.nextcloud.com/apps/oidc_login
|
||||||
if (\OC::$server->getConfig()->getAppValue('snappymail', 'snappymail-autologin-oidc', false)
|
if (\OC::$server->getConfig()->getAppValue('snappymail', 'snappymail-autologin-oidc', false)
|
||||||
&& \OC::$server->getSession()->get('is_oidc')
|
&& \OC::$server->getSession()->get('is_oidc')
|
||||||
|
@ -99,7 +100,6 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
\array_unshift($oSettings->SASLMechanisms, 'OAUTHBEARER');
|
\array_unshift($oSettings->SASLMechanisms, 'OAUTHBEARER');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue