mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Bugfix: allow space in password
Bugfix: throw ClientException on failure See #51
This commit is contained in:
parent
a528c93d47
commit
fbd333cf4a
1 changed files with 8 additions and 8 deletions
|
|
@ -116,18 +116,16 @@ class ChangePasswordPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
$sPrevPassword = $this->jsonParam('PrevPassword');
|
$sPrevPassword = $this->jsonParam('PrevPassword');
|
||||||
$sNewPassword = $this->jsonParam('NewPassword');
|
|
||||||
|
|
||||||
if ($sPrevPassword !== $oAccount->Password()) {
|
if ($sPrevPassword !== $oAccount->Password()) {
|
||||||
throw new ClientException(static::CurrentPasswordIncorrect, null, $oActions->StaticI18N('NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT'));
|
throw new ClientException(static::CurrentPasswordIncorrect, null, $oActions->StaticI18N('NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$sPasswordForCheck = \trim($sNewPassword);
|
$sNewPassword = $this->jsonParam('NewPassword');
|
||||||
if ($this->Config()->Get('plugin', 'pass_min_length', 10) > \strlen($sPasswordForCheck)) {
|
if ($this->Config()->Get('plugin', 'pass_min_length', 10) > \strlen($sNewPassword)) {
|
||||||
throw new ClientException(static::NewPasswordShort, null, $oActions->StaticI18N('NOTIFICATIONS/NEW_PASSWORD_SHORT'));
|
throw new ClientException(static::NewPasswordShort, null, $oActions->StaticI18N('NOTIFICATIONS/NEW_PASSWORD_SHORT'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->Config()->Get('plugin', 'pass_min_strength', 60) > static::PasswordStrength($sPasswordForCheck)) {
|
if ($this->Config()->Get('plugin', 'pass_min_strength', 60) > static::PasswordStrength($sNewPassword)) {
|
||||||
throw new ClientException(static::NewPasswordWeak, null, $oActions->StaticI18N('NOTIFICATIONS/NEW_PASSWORD_WEAK'));
|
throw new ClientException(static::NewPasswordWeak, null, $oActions->StaticI18N('NOTIFICATIONS/NEW_PASSWORD_WEAK'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -163,11 +161,13 @@ class ChangePasswordPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($bResult) {
|
if (!$bResult) {
|
||||||
$oAccount->SetPassword($sNewPassword);
|
throw new ClientException(static::CouldNotSaveNewPassword);
|
||||||
$oActions->SetAuthToken($oAccount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$oAccount->SetPassword($sNewPassword);
|
||||||
|
$oActions->SetAuthToken($oAccount);
|
||||||
|
|
||||||
return $oActions->GetSpecAuthToken();
|
return $oActions->GetSpecAuthToken();
|
||||||
// return $this->jsonResponse(__FUNCTION__, $oActions->GetSpecAuthToken());
|
// return $this->jsonResponse(__FUNCTION__, $oActions->GetSpecAuthToken());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue