Skip to content

Commit

Permalink
Resolve #1746
Browse files Browse the repository at this point in the history
  • Loading branch information
the-djmaze committed Sep 16, 2024
1 parent ed41d8e commit 61e7c00
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public static function startApp(bool $handle = false)
if ($doLogin && $aCredentials[1] && $aCredentials[2]) {
try {
$ocSession = \OC::$server->getSession();
if ($ocSession->get('is_oidc')) {
if (true === $aCredentials[2]) {
// OIDC
$pwd = new \SnappyMail\SensitiveString($aCredentials[1]);
$oAccount = $oActions->LoginProcess($aCredentials[1], $pwd);
if ($oAccount) {
Expand All @@ -102,7 +103,7 @@ public static function startApp(bool $handle = false)
$oAccount = $oActions->LoginProcess($aCredentials[1], $aCredentials[2]);
if ($oAccount && $oConfig->Get('login', 'sign_me_auto', \RainLoop\Enumerations\SignMeType::DefaultOff) === \RainLoop\Enumerations\SignMeType::DefaultOn) {
$oActions->SetSignMeToken($oAccount);
}
}
}
} catch (\Throwable $e) {
// Login failure, reset password to prevent more attempts
Expand Down Expand Up @@ -155,9 +156,9 @@ private static function getLoginCredentials() : array
if ($config->getAppValue('snappymail', 'snappymail-autologin-oidc', false)) {
if ($ocSession->get('is_oidc')) {
// IToken->getPassword() ???
if ($sAccessToken = $ocSession->get('oidc_access_token')) {
if ($ocSession->get('oidc_access_token')) {
$sEmail = $config->getUserValue($sUID, 'settings', 'email');
return [$sUID, $sEmail, $sAccessToken];
return [$sUID, $sEmail, true];
}
\SnappyMail\Log::debug('Nextcloud', 'OIDC access_token missing');
} else {
Expand Down
1 change: 1 addition & 0 deletions plugins/nextcloud/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public function beforeLogin(\RainLoop\Model\Account $oAccount, \MailSo\Net\NetCl
&& \OC::$server->getSession()->get('is_oidc')
&& $sNcEmail === $oSettings->username
&& !$bAccountDefinedExplicitly
&& $oAccount instanceof \RainLoop\Model\MainAccount
// && $oClient->supportsAuthType('OAUTHBEARER') // v2.28
) {
$sAccessToken = \OC::$server->getSession()->get('oidc_access_token');
Expand Down

0 comments on commit 61e7c00

Please sign in to comment.