mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 15:45:55 +08:00
Added allow_universal_login setting (login in to admin panel using main login form)
This commit is contained in:
parent
81d3d40369
commit
79ad7ccd0b
|
@ -125,10 +125,17 @@
|
|||
sTitle = ((Utils.isNormal(sTitle) && 0 < sTitle.length) ? sTitle + ' - ' : '') +
|
||||
Settings.settingsGet('Title') || '';
|
||||
|
||||
window.document.title = '';
|
||||
window.document.title = sTitle + ' ...';
|
||||
window.document.title = sTitle;
|
||||
};
|
||||
|
||||
AbstractApp.prototype.redirectToAdminPanel = function ()
|
||||
{
|
||||
_.delay(function () {
|
||||
window.location.href = './?/Admin/';
|
||||
}, 100);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {boolean=} bLogout = false
|
||||
* @param {boolean=} bClose = false
|
||||
|
@ -149,7 +156,8 @@
|
|||
window.close();
|
||||
}
|
||||
|
||||
if (bLogout && '' !== sCustomLogoutLink && window.location.href !== sCustomLogoutLink)
|
||||
sCustomLogoutLink = sCustomLogoutLink || './';
|
||||
if (bLogout && window.location.href !== sCustomLogoutLink)
|
||||
{
|
||||
_.delay(function () {
|
||||
if (bInIframe && window.parent)
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
PaneSettingsAdminView.prototype.logoutClick = function ()
|
||||
{
|
||||
Remote.adminLogout(function () {
|
||||
require('App/Admin').loginAndLogoutReload();
|
||||
require('App/Admin').loginAndLogoutReload(true);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -128,6 +128,10 @@
|
|||
|
||||
this.submitRequest(false);
|
||||
}
|
||||
else if (oData.Admin)
|
||||
{
|
||||
require('App/App').redirectToAdminPanel();
|
||||
}
|
||||
else
|
||||
{
|
||||
require('App/App').loginAndLogoutReload();
|
||||
|
|
|
@ -1606,6 +1606,16 @@ class Actions
|
|||
return $sEncryptedData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sEmail
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function generateSignMeToken($sEmail)
|
||||
{
|
||||
return \md5(\microtime(true).APP_SALT.\rand(10000, 99999).$sEmail);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*
|
||||
|
@ -1624,11 +1634,33 @@ class Actions
|
|||
$oAccount = null;
|
||||
|
||||
$sPassword = $this->clientRsaDecryptHelper($sPassword);
|
||||
$this->Logger()->AddSecret($sPassword);
|
||||
|
||||
if (0 < \strlen($sEmail) && 0 < \strlen($sPassword) &&
|
||||
$this->Config()->Get('security', 'allow_universal_login', true) &&
|
||||
$this->Config()->Get('security', 'allow_admin_panel', true) &&
|
||||
$sEmail === $this->Config()->Get('security', 'admin_login', '')
|
||||
)
|
||||
{
|
||||
if ($this->Config()->ValidatePassword($sPassword))
|
||||
{
|
||||
$this->setAdminAuthToken($this->getAdminToken());
|
||||
|
||||
return $this->DefaultResponse(__FUNCTION__, true, array(
|
||||
'Admin' => true
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->loginErrorDelay();
|
||||
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::AuthError);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$oAccount = $this->LoginProcess($sEmail, $sPassword,
|
||||
$bSignMe ? \md5(\microtime(true).APP_SALT.\rand(10000, 99999).$sEmail) : '',
|
||||
$bSignMe ? $this->generateSignMeToken($sEmail) : '',
|
||||
$sAdditionalCode, $bAdditionalCodeSignMe);
|
||||
}
|
||||
catch (\RainLoop\Exceptions\ClientException $oException)
|
||||
|
|
|
@ -107,6 +107,7 @@ class Application extends \RainLoop\Config\AbstractConfig
|
|||
'admin_password' => array('12345'),
|
||||
'allow_admin_panel' => array(true, 'Access settings'),
|
||||
'allow_two_factor_auth' => array(false),
|
||||
'allow_universal_login' => array(true),
|
||||
'admin_panel_host' => array(''),
|
||||
'core_install_access_domain' => array('')
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue