From a769e1ea350a458a17dd9198ef3a6a3969f13372 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Sun, 25 Jun 2023 01:54:53 +0200 Subject: [PATCH] Add two user-management-focused exceptions --- exceptions/updates/MDInsufficientPassword.php | 27 +++++++++++++++++++ .../updates/MDUserPasswordsDoNotMatch.php | 27 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 exceptions/updates/MDInsufficientPassword.php create mode 100644 exceptions/updates/MDUserPasswordsDoNotMatch.php diff --git a/exceptions/updates/MDInsufficientPassword.php b/exceptions/updates/MDInsufficientPassword.php new file mode 100644 index 0000000..e49f3fb --- /dev/null +++ b/exceptions/updates/MDInsufficientPassword.php @@ -0,0 +1,27 @@ + + */ +declare(strict_types = 1); + +/** + * This file contains an exception class to be thrown if users try to set + * insufficient / too weak passwords. + */ +final class MDInsufficientPassword extends MDgenericInvalidInputsException { + /** + * Error message. + * + * @return string + */ + public function errorMessage() { + //error message + return 'Insufficient / weak password: ' . $this->getMessage(); + + } +} diff --git a/exceptions/updates/MDUserPasswordsDoNotMatch.php b/exceptions/updates/MDUserPasswordsDoNotMatch.php new file mode 100644 index 0000000..0c496ab --- /dev/null +++ b/exceptions/updates/MDUserPasswordsDoNotMatch.php @@ -0,0 +1,27 @@ + + */ +declare(strict_types = 1); + +/** + * Custom exception class to be raised if users' password and password + * verification don't match. + */ +final class MDUserPasswordsDoNotMatch extends MDgenericInvalidInputsException { + /** + * Error message. + * + * @return string + */ + public function errorMessage() { + //error message + return 'Passwords don\'t match: ' . $this->getMessage(); + + } +}