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

Commit 7df1d55

Browse files
author
the-djmaze
committed
Nextcloud don't use RainLoop login credentials
1 parent b7a11d4 commit 7df1d55

File tree

2 files changed

+0
-69
lines changed

2 files changed

+0
-69
lines changed

integrations/nextcloud/snappymail/lib/Settings/PersonalSettings.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,6 @@ public function getForm()
1818
{
1919
$uid = \OC::$server->getUserSession()->getUser()->getUID();
2020
$sEmail = $this->config->getUserValue($uid, 'snappymail', 'snappymail-email');
21-
if (!$sEmail) {
22-
$aRainLoop = \OCA\SnappyMail\Util\RainLoop::getLoginCredentials($uid, $this->config);
23-
if ($aRainLoop) {
24-
$sEmail = $aRainLoop[0];
25-
$this->config->setUserValue($uid, 'snappymail', 'snappymail-email', $sEmail);
26-
if ($aRainLoop[1]) {
27-
$this->config->setUserValue($uid, 'snappymail', 'passphrase',
28-
\OCA\SnappyMail\Util\SnappyMailHelper::encodePassword($aRainLoop[1], \md5($sEmail))
29-
);
30-
}
31-
}
32-
}
3321
if ($sPass = $this->config->getUserValue($uid, 'snappymail', 'snappymail-password')) {
3422
$this->config->deleteUserValue($uid, 'snappymail', 'snappymail-password');
3523
$this->config->setUserValue($uid, 'snappymail', 'passphrase', $sPass);

integrations/nextcloud/snappymail/lib/Util/RainLoop.php

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,6 @@
44

55
class RainLoop
66
{
7-
8-
public static function getLoginCredentials($sUID, $config) : ?array
9-
{
10-
$sEmail = \trim($config->getUserValue($sUID, 'rainloop', 'rainloop-email'));
11-
if ($sEmail) {
12-
$sPassword = $config->getUserValue($sUID, 'rainloop', 'rainloop-password', '');
13-
return [
14-
$sEmail,
15-
$sPassword ? static::decodePassword($sPassword, \md5($sEmail)) : ''
16-
];
17-
}
18-
return null;
19-
}
20-
217
/**
228
* Imports data from RainLoop
239
* skips: /data/rainloop-storage/_data_/_default_/configs/application.ini
@@ -82,47 +68,4 @@ public static function import() : array
8268

8369
return $result;
8470
}
85-
86-
/**
87-
* @param string $sPassword
88-
* @param string $sSalt
89-
*
90-
* @return string
91-
*/
92-
public static function decodePassword($sPassword, $sSalt)
93-
{
94-
$sPassword = \base64_decode(\trim($sPassword));
95-
96-
$method = 'AES-256-CBC';
97-
if (\function_exists('openssl_encrypt')
98-
&& \function_exists('openssl_decrypt')
99-
&& \function_exists('openssl_random_pseudo_bytes')
100-
&& \function_exists('openssl_cipher_iv_length')
101-
&& \function_exists('openssl_get_cipher_methods')
102-
&& \defined('OPENSSL_RAW_DATA')
103-
&& \defined('OPENSSL_ZERO_PADDING')
104-
&& \in_array($method, \openssl_get_cipher_methods())
105-
) {
106-
$aParts = \explode('|', $sPassword, 2);
107-
if (\is_array($aParts) && !empty($aParts[0]) && !empty($aParts[1])) {
108-
$sData = \base64_decode($aParts[0]);
109-
$iv = \base64_decode($aParts[1]);
110-
return \base64_decode(\trim(
111-
\openssl_decrypt($sData, $method, \md5($sSalt), OPENSSL_RAW_DATA, $iv)
112-
));
113-
}
114-
}
115-
116-
if (\function_exists('mcrypt_encrypt')
117-
&& \function_exists('mcrypt_decrypt')
118-
&& \defined('MCRYPT_RIJNDAEL_256')
119-
&& \defined('MCRYPT_MODE_ECB')
120-
) {
121-
return \base64_decode(\trim(
122-
\mcrypt_decrypt(MCRYPT_RIJNDAEL_256, \md5($sSalt), $sPassword, MCRYPT_MODE_ECB)
123-
));
124-
}
125-
126-
return $sPassword;
127-
}
12871
}

0 commit comments

Comments
 (0)