mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Added AdditionalOptions for SsoHash
This commit is contained in:
parent
93d275c192
commit
2a90664574
2 changed files with 34 additions and 1 deletions
|
|
@ -130,17 +130,19 @@ class Api
|
||||||
/**
|
/**
|
||||||
* @param string $sEmail
|
* @param string $sEmail
|
||||||
* @param string $sPassword
|
* @param string $sPassword
|
||||||
|
* @param array $aAdditionalOptions = array()
|
||||||
* @param bool $bUseTimeout = true
|
* @param bool $bUseTimeout = true
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function GetUserSsoHash($sEmail, $sPassword, $bUseTimeout = true)
|
public static function GetUserSsoHash($sEmail, $sPassword, $aAdditionalOptions = array(), $bUseTimeout = true)
|
||||||
{
|
{
|
||||||
$sSsoHash = \MailSo\Base\Utils::Sha1Rand($sEmail.$sPassword);
|
$sSsoHash = \MailSo\Base\Utils::Sha1Rand($sEmail.$sPassword);
|
||||||
|
|
||||||
return \RainLoop\Api::Actions()->Cacher()->Set(\RainLoop\KeyPathHelper::SsoCacherKey($sSsoHash), \RainLoop\Utils::EncodeKeyValues(array(
|
return \RainLoop\Api::Actions()->Cacher()->Set(\RainLoop\KeyPathHelper::SsoCacherKey($sSsoHash), \RainLoop\Utils::EncodeKeyValues(array(
|
||||||
'Email' => $sEmail,
|
'Email' => $sEmail,
|
||||||
'Password' => $sPassword,
|
'Password' => $sPassword,
|
||||||
|
'AdditionalOptions' => $aAdditionalOptions,
|
||||||
'Time' => $bUseTimeout ? \time() : 0
|
'Time' => $bUseTimeout ? \time() : 0
|
||||||
))) ? $sSsoHash : '';
|
))) ? $sSsoHash : '';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -898,9 +898,40 @@ class ServiceActions
|
||||||
$sEmail = \trim($mData['Email']);
|
$sEmail = \trim($mData['Email']);
|
||||||
$sPassword = $mData['Password'];
|
$sPassword = $mData['Password'];
|
||||||
|
|
||||||
|
$aAdditionalOptions = isset($mData['AdditionalOptions']) && \is_array($mData['AdditionalOptions']) &&
|
||||||
|
0 < \count($mData['AdditionalOptions']) ? $mData['AdditionalOptions'] : null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$oAccount = $this->oActions->LoginProcess($sEmail, $sPassword);
|
$oAccount = $this->oActions->LoginProcess($sEmail, $sPassword);
|
||||||
|
|
||||||
|
if ($oAccount instanceof \RainLoop\Model\Account && $aAdditionalOptions)
|
||||||
|
{
|
||||||
|
$bNeedToSettings = false;
|
||||||
|
|
||||||
|
$oSettings = $this->SettingsProvider()->Load($oAccount);
|
||||||
|
if ($oSettings)
|
||||||
|
{
|
||||||
|
$sLanguage = isset($aAdditionalOptions['Language']) ?
|
||||||
|
$aAdditionalOptions['Language'] : '';
|
||||||
|
|
||||||
|
if ($sLanguage)
|
||||||
|
{
|
||||||
|
$sLanguage = $this->oActions->ValidateLanguage($sLanguage);
|
||||||
|
if ($sLanguage !== $oSettings->GetConf('Language', ''))
|
||||||
|
{
|
||||||
|
$bNeedToSettings = true;
|
||||||
|
$oSettings->SetConf('Language', $sLanguage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($bNeedToSettings)
|
||||||
|
{
|
||||||
|
$this->SettingsProvider()->Save($oAccount, $oSettings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->oActions->AuthToken($oAccount);
|
$this->oActions->AuthToken($oAccount);
|
||||||
|
|
||||||
$bLogout = !($oAccount instanceof \RainLoop\Model\Account);
|
$bLogout = !($oAccount instanceof \RainLoop\Model\Account);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue