mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 16:37:02 +03:00
Resolve #969
This commit is contained in:
parent
8c97b64a55
commit
38c4b4e26e
4 changed files with 23 additions and 19 deletions
|
|
@ -73,11 +73,18 @@ class SnappyMailHelper
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if ($doLogin && $aCredentials[1] && $aCredentials[2]) {
|
if ($doLogin && $aCredentials[1] && $aCredentials[2]) {
|
||||||
$oActions->Logger()->AddSecret($aCredentials[2]);
|
try {
|
||||||
$oAccount = $oActions->LoginProcess($aCredentials[1], $aCredentials[2], false);
|
$oActions->Logger()->AddSecret($aCredentials[2]);
|
||||||
if ($oAccount) {
|
$oAccount = $oActions->LoginProcess($aCredentials[1], $aCredentials[2], false);
|
||||||
$oActions->Plugins()->RunHook('login.success', array($oAccount));
|
if ($oAccount) {
|
||||||
$oActions->SetAuthToken($oAccount);
|
$oActions->Plugins()->RunHook('login.success', array($oAccount));
|
||||||
|
$oActions->SetAuthToken($oAccount);
|
||||||
|
}
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
// Login failure, reset password to prevent more attempts
|
||||||
|
$sUID = \OC::$server->getUserSession()->getUser()->getUID();
|
||||||
|
\OC::$server->getSession()['snappymail-password'] = '';
|
||||||
|
\OC::$server->getConfig()->setUserValue($sUID, 'snappymail', 'snappymail-password', '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ abstract class NetClient
|
||||||
|
|
||||||
if ($this->IsConnected()) {
|
if ($this->IsConnected()) {
|
||||||
$this->writeLogException(new Exceptions\SocketAlreadyConnectedException, \LOG_ERR, false);
|
$this->writeLogException(new Exceptions\SocketAlreadyConnectedException, \LOG_ERR, false);
|
||||||
return;
|
$this->Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->Settings = $oSettings;
|
$this->Settings = $oSettings;
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,12 @@ trait User
|
||||||
|
|
||||||
$this->Logger()->AddSecret($sPassword);
|
$this->Logger()->AddSecret($sPassword);
|
||||||
|
|
||||||
$oAccount = $this->LoginProcess($sEmail, $sPassword, $bSignMe);
|
try {
|
||||||
|
$oAccount = $this->LoginProcess($sEmail, $sPassword, $bSignMe);
|
||||||
|
} catch (\Throwable $oException) {
|
||||||
|
$this->loginErrorDelay();
|
||||||
|
throw $oException;
|
||||||
|
}
|
||||||
|
|
||||||
$this->SetAuthToken($oAccount);
|
$this->SetAuthToken($oAccount);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,6 @@ trait UserAuth
|
||||||
$this->resolveLoginCredentials($sEmail, $sPassword, $sLogin);
|
$this->resolveLoginCredentials($sEmail, $sPassword, $sLogin);
|
||||||
|
|
||||||
if (!\str_contains($sEmail, '@') || !\strlen($sPassword)) {
|
if (!\str_contains($sEmail, '@') || !\strlen($sPassword)) {
|
||||||
$this->loginErrorDelay();
|
|
||||||
throw new ClientException(Notifications::InvalidInputArgument);
|
throw new ClientException(Notifications::InvalidInputArgument);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -135,20 +134,13 @@ trait UserAuth
|
||||||
}
|
}
|
||||||
} catch (\Throwable $oException) {
|
} catch (\Throwable $oException) {
|
||||||
$this->LoggerAuthHelper($oAccount, $this->getAdditionalLogParamsByUserLogin($sInputEmail));
|
$this->LoggerAuthHelper($oAccount, $this->getAdditionalLogParamsByUserLogin($sInputEmail));
|
||||||
$this->loginErrorDelay();
|
|
||||||
throw $oException;
|
throw $oException;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
$this->imapConnect($oAccount, true);
|
||||||
$this->imapConnect($oAccount, true);
|
if ($bMainAccount) {
|
||||||
if ($bMainAccount) {
|
$bSignMe && $this->SetSignMeToken($oAccount);
|
||||||
$bSignMe && $this->SetSignMeToken($oAccount);
|
$this->StorageProvider()->Put($oAccount, StorageType::SESSION, Utils::GetSessionToken(), 'true');
|
||||||
$this->StorageProvider()->Put($oAccount, StorageType::SESSION, Utils::GetSessionToken(), 'true');
|
|
||||||
}
|
|
||||||
} catch (\Throwable $oException) {
|
|
||||||
$this->loginErrorDelay();
|
|
||||||
|
|
||||||
throw $oException;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $oAccount;
|
return $oAccount;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue