mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 13:39:22 +03:00
Some fixes for new owncloud functionality
+ Small other fixes
This commit is contained in:
parent
7d030583c5
commit
2dd9b076fe
14 changed files with 440 additions and 453 deletions
|
|
@ -28,30 +28,6 @@ class OC_RainLoop_Helper
|
|||
return $SsoHash;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sSsoHash
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function clearUserSsoHash($sSsoHash)
|
||||
{
|
||||
$result = false;
|
||||
|
||||
$sPath = rtrim(trim($sPath), '\\/').'/index.php';
|
||||
if (file_exists($sPath))
|
||||
{
|
||||
$_ENV['RAINLOOP_INCLUDE_AS_API'] = true;
|
||||
include $sPath;
|
||||
|
||||
if (class_exists('\\RainLoop\\Api'))
|
||||
{
|
||||
$result = \RainLoop\Api::ClearUserSsoHash($sSsoHash);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sUrl
|
||||
*
|
||||
|
|
@ -59,8 +35,8 @@ class OC_RainLoop_Helper
|
|||
*/
|
||||
public static function normalizeUrl($sUrl)
|
||||
{
|
||||
$sUrl = \rtrim(\trim($sUrl), '/\\');
|
||||
if ('.php' !== \strtolower(\substr($sUrl, -4)))
|
||||
$sUrl = rtrim(trim($sUrl), '/\\');
|
||||
if ('.php' !== strtolower(substr($sUrl, -4)))
|
||||
{
|
||||
$sUrl .= '/';
|
||||
}
|
||||
|
|
@ -92,54 +68,58 @@ class OC_RainLoop_Helper
|
|||
return @base64_decode(trim($sPassword));
|
||||
}
|
||||
|
||||
public static function login($params)
|
||||
/**
|
||||
* @param array $aParams
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function login($aParams)
|
||||
{
|
||||
$sUser = $params['uid'];
|
||||
$sEmail = $sUser;
|
||||
$sPassword = $params['password'];
|
||||
|
||||
$sUrl = trim(OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
||||
$sPath = trim(OCP\Config::getAppValue('rainloop', 'rainloop-path', ''));
|
||||
|
||||
if ('' !== $sUrl && '' !== $sPath)
|
||||
if (isset($aParams['uid'], $aParams['password']))
|
||||
{
|
||||
$sPassword = self::encodePassword($sPassword, md5($sEmail));
|
||||
return OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-password', $sPassword);
|
||||
$sUser = $aParams['uid'];
|
||||
|
||||
$sEmail = $sUser;
|
||||
$sPassword = $aParams['password'];
|
||||
|
||||
$sUrl = trim(OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
||||
$sPath = trim(OCP\Config::getAppValue('rainloop', 'rainloop-path', ''));
|
||||
|
||||
if ('' !== $sUrl && '' !== $sPath)
|
||||
{
|
||||
$sPassword = self::encodePassword($sPassword, md5($sEmail));
|
||||
return OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-autologin-password', $sPassword);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function logout($params)
|
||||
public static function logout()
|
||||
{
|
||||
$sUser = OCP\User::getUser();
|
||||
$sSsoHash = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-ssohash', '');
|
||||
|
||||
$a = OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-password', null);
|
||||
$b = OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-ssohash', null);
|
||||
|
||||
if('' !== $sSsoHash) {
|
||||
self::clearUserSsoHash($sSsoHash);
|
||||
}
|
||||
|
||||
return $a && $b;
|
||||
return OCP\Config::setUserValue(
|
||||
OCP\User::getUser(), 'rainloop', 'rainloop-autologin-password', '');
|
||||
}
|
||||
|
||||
public static function changePassword($params)
|
||||
public static function changePassword($aParams)
|
||||
{
|
||||
$sUser = $params['uid'];
|
||||
$sEmail = $sUser;
|
||||
$sPassword = $params['password'];
|
||||
|
||||
OCP\Util::writeLog('rainloop', 'rainloop|login: Setting new RainLoop password for '. $sEmail, OCP\Util::DEBUG);
|
||||
|
||||
$sUrl = trim(OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
||||
$sPath = trim(OCP\Config::getAppValue('rainloop', 'rainloop-path', ''));
|
||||
|
||||
if ('' !== $sUrl && '' !== $sPath)
|
||||
if (isset($aParams['uid'], $aParams['password']))
|
||||
{
|
||||
$sPassword = self::encodePassword($sPassword, md5($sEmail));
|
||||
return OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-password', $sPassword);
|
||||
$sUser = $aParams['uid'];
|
||||
|
||||
$sEmail = $sUser;
|
||||
$sPassword = $aParams['password'];
|
||||
|
||||
$sUrl = trim(OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
||||
$sPath = trim(OCP\Config::getAppValue('rainloop', 'rainloop-path', ''));
|
||||
|
||||
if ('' !== $sUrl && '' !== $sPath)
|
||||
{
|
||||
OCP\Util::writeLog('rainloop', 'rainloop|login: Setting new RainLoop password for '.$sEmail, OCP\Util::DEBUG);
|
||||
|
||||
$sPassword = self::encodePassword($sPassword, md5($sEmail));
|
||||
return OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-password', $sPassword);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue