Loading lib/Controller/AccountController.php +2 −1 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ use OCA\EcloudAccounts\AppInfo\Application; use OCA\EcloudAccounts\Exception\AddUsernameToCommonStoreException; use OCA\EcloudAccounts\Exception\BlacklistedEmailException; use OCA\EcloudAccounts\Exception\LDAPUserCreationException; use OCA\EcloudAccounts\Exception\RecoveryEmailValidationException; use OCA\EcloudAccounts\Service\CaptchaService; use OCA\EcloudAccounts\Service\NewsLetterService; use OCA\EcloudAccounts\Service\UserService; Loading Loading @@ -168,7 +169,7 @@ class AccountController extends Controller { $this->logger->logException($e, ['app' => Application::APP_ID]); $response->setData(['message' => 'A server-side error occurred while processing your request! Please try again later.', 'success' => false]); $response->setStatus(500); } catch (BlacklistedEmailException | Error $e) { } catch (BlacklistedEmailException | RecoveryEmailValidationException | Error $e) { $this->logger->logException($e, ['app' => Application::APP_ID]); $response->setData(['message' => $e->getMessage(), 'success' => false]); $response->setStatus(500); Loading lib/Exception/RecoveryEmailValidationException.php 0 → 100644 +9 −0 Original line number Diff line number Diff line <?php namespace OCA\EcloudAccounts\Exception; class RecoveryEmailValidationException extends \Exception { public function __construct($message = null, $code = 0) { parent::__construct($message, $code); } } lib/Service/UserService.php +4 −3 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ use OCA\EcloudAccounts\AppInfo\Application; use OCA\EcloudAccounts\Exception\AddUsernameToCommonStoreException; use OCA\EcloudAccounts\Exception\BlacklistedEmailException; use OCA\EcloudAccounts\Exception\LDAPUserCreationException; use OCA\EcloudAccounts\Exception\RecoveryEmailValidationException; use OCP\Defaults; use OCP\IConfig; use OCP\ILogger; Loading Loading @@ -267,13 +268,13 @@ class UserService { */ public function validateRecoveryEmail(string $recoveryEmail): void { if (!$this->isValidEmailFormat($recoveryEmail)) { throw new Exception('Recovery email address has an incorrect format.'); throw new RecoveryEmailValidationException('Recovery email address has an incorrect format.'); } if ($this->checkRecoveryEmailAvailable($recoveryEmail)) { throw new Exception('Recovery email address is already taken.'); throw new RecoveryEmailValidationException('Recovery email address is already taken.'); } if ($this->isRecoveryEmailDomainDisallowed($recoveryEmail)) { throw new Exception('You cannot set an email address with a Murena domain as recovery email address.'); throw new RecoveryEmailValidationException('You cannot set an email address with a Murena domain as recovery email address.'); } if ($this->blackListService->isBlacklistedEmail($recoveryEmail)) { throw new BlacklistedEmailException('The domain of this email address is blacklisted. Please provide another recovery address.'); Loading Loading
lib/Controller/AccountController.php +2 −1 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ use OCA\EcloudAccounts\AppInfo\Application; use OCA\EcloudAccounts\Exception\AddUsernameToCommonStoreException; use OCA\EcloudAccounts\Exception\BlacklistedEmailException; use OCA\EcloudAccounts\Exception\LDAPUserCreationException; use OCA\EcloudAccounts\Exception\RecoveryEmailValidationException; use OCA\EcloudAccounts\Service\CaptchaService; use OCA\EcloudAccounts\Service\NewsLetterService; use OCA\EcloudAccounts\Service\UserService; Loading Loading @@ -168,7 +169,7 @@ class AccountController extends Controller { $this->logger->logException($e, ['app' => Application::APP_ID]); $response->setData(['message' => 'A server-side error occurred while processing your request! Please try again later.', 'success' => false]); $response->setStatus(500); } catch (BlacklistedEmailException | Error $e) { } catch (BlacklistedEmailException | RecoveryEmailValidationException | Error $e) { $this->logger->logException($e, ['app' => Application::APP_ID]); $response->setData(['message' => $e->getMessage(), 'success' => false]); $response->setStatus(500); Loading
lib/Exception/RecoveryEmailValidationException.php 0 → 100644 +9 −0 Original line number Diff line number Diff line <?php namespace OCA\EcloudAccounts\Exception; class RecoveryEmailValidationException extends \Exception { public function __construct($message = null, $code = 0) { parent::__construct($message, $code); } }
lib/Service/UserService.php +4 −3 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ use OCA\EcloudAccounts\AppInfo\Application; use OCA\EcloudAccounts\Exception\AddUsernameToCommonStoreException; use OCA\EcloudAccounts\Exception\BlacklistedEmailException; use OCA\EcloudAccounts\Exception\LDAPUserCreationException; use OCA\EcloudAccounts\Exception\RecoveryEmailValidationException; use OCP\Defaults; use OCP\IConfig; use OCP\ILogger; Loading Loading @@ -267,13 +268,13 @@ class UserService { */ public function validateRecoveryEmail(string $recoveryEmail): void { if (!$this->isValidEmailFormat($recoveryEmail)) { throw new Exception('Recovery email address has an incorrect format.'); throw new RecoveryEmailValidationException('Recovery email address has an incorrect format.'); } if ($this->checkRecoveryEmailAvailable($recoveryEmail)) { throw new Exception('Recovery email address is already taken.'); throw new RecoveryEmailValidationException('Recovery email address is already taken.'); } if ($this->isRecoveryEmailDomainDisallowed($recoveryEmail)) { throw new Exception('You cannot set an email address with a Murena domain as recovery email address.'); throw new RecoveryEmailValidationException('You cannot set an email address with a Murena domain as recovery email address.'); } if ($this->blackListService->isBlacklistedEmail($recoveryEmail)) { throw new BlacklistedEmailException('The domain of this email address is blacklisted. Please provide another recovery address.'); Loading