Bugfix: Nextcloud getPrimaryEMailAddress() on null

This commit is contained in:
the-djmaze 2024-05-27 10:13:20 +02:00
parent 4bb1b41505
commit ab2f646496

View file

@ -74,14 +74,14 @@ 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(); $ocUser = \OC::$server->getUserSession()->getUser();
$sEmail = $ocUser->getEMailAddress() ?: $oc->user->getPrimaryEMailAddress(); $sEmail = $ocUser->getEMailAddress() ?: $ocUser->getPrimaryEMailAddress();
$sLogin = $ocUser->getUID(); $sLogin = $ocUser->getUID();
} }
public function loginCredentials2(string &$sEmail, ?string &$sPassword = null) : void public function loginCredentials2(string &$sEmail, ?string &$sPassword = null) : void
{ {
$ocUser = \OC::$server->getUserSession()->getUser(); $ocUser = \OC::$server->getUserSession()->getUser();
$sEmail = $ocUser->getEMailAddress() ?: $oc->user->getPrimaryEMailAddress(); $sEmail = $ocUser->getEMailAddress() ?: $ocUser->getPrimaryEMailAddress();
} }
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
@ -243,7 +243,7 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
} }
if (!$sEmail) { if (!$sEmail) {
$sEmail = $ocUser->getEMailAddress(); $sEmail = $ocUser->getEMailAddress();
// ?: $oc->user->getPrimaryEMailAddress(); // ?: $ocUser->getPrimaryEMailAddress();
} }
/* /*
if ($config->getAppValue('snappymail', 'snappymail-autologin-oidc', false)) { if ($config->getAppValue('snappymail', 'snappymail-autologin-oidc', false)) {