mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 12:09:20 +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]) {
|
||||
$oActions->Logger()->AddSecret($aCredentials[2]);
|
||||
$oAccount = $oActions->LoginProcess($aCredentials[1], $aCredentials[2], false);
|
||||
if ($oAccount) {
|
||||
$oActions->Plugins()->RunHook('login.success', array($oAccount));
|
||||
$oActions->SetAuthToken($oAccount);
|
||||
try {
|
||||
$oActions->Logger()->AddSecret($aCredentials[2]);
|
||||
$oAccount = $oActions->LoginProcess($aCredentials[1], $aCredentials[2], false);
|
||||
if ($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()) {
|
||||
$this->writeLogException(new Exceptions\SocketAlreadyConnectedException, \LOG_ERR, false);
|
||||
return;
|
||||
$this->Disconnect();
|
||||
}
|
||||
|
||||
$this->Settings = $oSettings;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,12 @@ trait User
|
|||
|
||||
$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);
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,6 @@ trait UserAuth
|
|||
$this->resolveLoginCredentials($sEmail, $sPassword, $sLogin);
|
||||
|
||||
if (!\str_contains($sEmail, '@') || !\strlen($sPassword)) {
|
||||
$this->loginErrorDelay();
|
||||
throw new ClientException(Notifications::InvalidInputArgument);
|
||||
}
|
||||
|
||||
|
|
@ -135,20 +134,13 @@ trait UserAuth
|
|||
}
|
||||
} catch (\Throwable $oException) {
|
||||
$this->LoggerAuthHelper($oAccount, $this->getAdditionalLogParamsByUserLogin($sInputEmail));
|
||||
$this->loginErrorDelay();
|
||||
throw $oException;
|
||||
}
|
||||
|
||||
try {
|
||||
$this->imapConnect($oAccount, true);
|
||||
if ($bMainAccount) {
|
||||
$bSignMe && $this->SetSignMeToken($oAccount);
|
||||
$this->StorageProvider()->Put($oAccount, StorageType::SESSION, Utils::GetSessionToken(), 'true');
|
||||
}
|
||||
} catch (\Throwable $oException) {
|
||||
$this->loginErrorDelay();
|
||||
|
||||
throw $oException;
|
||||
$this->imapConnect($oAccount, true);
|
||||
if ($bMainAccount) {
|
||||
$bSignMe && $this->SetSignMeToken($oAccount);
|
||||
$this->StorageProvider()->Put($oAccount, StorageType::SESSION, Utils::GetSessionToken(), 'true');
|
||||
}
|
||||
|
||||
return $oAccount;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue