mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
allow multi-account in nc with oauth login
This commit is contained in:
parent
fa15742edb
commit
97c0f81a2e
6 changed files with 15 additions and 13 deletions
|
|
@ -90,8 +90,15 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
public function beforeLogin(\RainLoop\Model\Account $oAccount, \MailSo\Net\NetClient $oClient, \MailSo\Net\ConnectSettings $oSettings) : void
|
||||
{
|
||||
// https://apps.nextcloud.com/apps/oidc_login
|
||||
$ocUser = \OC::$server->getUserSession()->getUser();
|
||||
$sNcEmail = $ocUser->getEMailAddress() ?: $ocUser->getPrimaryEMailAddress();
|
||||
|
||||
// Only login with OIDC access token if
|
||||
// it is enabled in config, the user is currently logged in with OIDC
|
||||
// and the current snappymail account is the OIDC account
|
||||
if (\OC::$server->getConfig()->getAppValue('snappymail', 'snappymail-autologin-oidc', false)
|
||||
&& \OC::$server->getSession()->get('is_oidc')
|
||||
&& $sNcEmail === $oSettings->username
|
||||
// && $oClient->supportsAuthType('OAUTHBEARER') // v2.28
|
||||
) {
|
||||
$sAccessToken = \OC::$server->getSession()->get('oidc_access_token');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue