Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

Commit 3ced479

Browse files
author
the-djmaze
committed
Example Nextcloud login override for #1544
1 parent 41fc419 commit 3ced479

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

plugins/nextcloud/index.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ public function Init() : void
3636
$this->addTemplate('templates/PopupsNextcloudFiles.html');
3737
$this->addTemplate('templates/PopupsNextcloudCalendars.html');
3838
/*
39-
// DISABLED https://github.com/the-djmaze/snappymail/issues/1420#issuecomment-1933045917
40-
$this->addHook('imap.before-login', 'oidcLogin');
41-
$this->addHook('smtp.before-login', 'oidcLogin');
42-
$this->addHook('sieve.before-login', 'oidcLogin');
39+
$this->addHook('login.credentials.step-2', 'loginCredentials');
40+
$this->addHook('login.credentials', 'loginCredentials');
41+
$this->addHook('imap.before-login', 'beforeLogin');
42+
$this->addHook('smtp.before-login', 'beforeLogin');
43+
$this->addHook('sieve.before-login', 'beforeLogin');
4344
*/
4445
} else {
4546
\SnappyMail\Log::debug('Nextcloud', 'NOT integrated');
@@ -70,6 +71,19 @@ public static function IsLoggedIn()
7071
return static::IsIntegrated() && \OC::$server->getUserSession()->isLoggedIn();
7172
}
7273

74+
public function loginCredentials(string &$sEmail, string &$sLogin, ?string &$sPassword = null) : void
75+
{
76+
$ocUser = \OC::$server->getUserSession()->getUser();
77+
// $sEmail = $ocUser->getEMailAddress() ?: $oc->user->getPrimaryEMailAddress();
78+
// $sLogin = $ocUser->getUID();
79+
}
80+
81+
public function beforeLogin(\RainLoop\Model\Account $oAccount, \MailSo\Net\NetClient $oClient, \MailSo\Net\ConnectSettings $oSettings) : void
82+
{
83+
// $oSettings->username = \OC::$server->getUserSession()->getUser()->getUID();
84+
// $this->oidcLogin($oAccount, $oClient, $oSettings);
85+
}
86+
7387
// https://apps.nextcloud.com/apps/oidc_login
7488
// DISABLED https://github.com/the-djmaze/snappymail/issues/1420#issuecomment-1933045917
7589
public function oidcLogin(\RainLoop\Model\Account $oAccount, \MailSo\Net\NetClient $oClient, \MailSo\Net\ConnectSettings $oSettings) : void

0 commit comments

Comments
 (0)