diff --git a/source/Backend/PasswordChecker.cpp b/source/Backend/PasswordChecker.cpp index 5c89cad..2ee63e3 100644 --- a/source/Backend/PasswordChecker.cpp +++ b/source/Backend/PasswordChecker.cpp @@ -1,39 +1,36 @@ #include "PasswordChecker.hpp" #include -PasswordChecker::PasswordChecker(const std::string& password) : password(password) {} +PasswordChecker::PasswordChecker(const std::string& password) + : password(password) {} bool PasswordChecker::isSafe() { - bool hasMinimumLength_ = hasMinimumLength(); - bool hasMinimumUppercase_ = hasMinimumUppercase(); - bool hasMinimumLowercase_ = hasMinimumLowercase(); - bool hasMinimumDigit_ = hasMinimumDigit(); - bool hasMinimumSpecialChar_ = hasMinimumSpecialChar(); - - return - hasMinimumLength_ && - hasMinimumUppercase_ && - hasMinimumLowercase_ && - hasMinimumDigit_ && - hasMinimumSpecialChar_; + bool hasMinimumLength_ = hasMinimumLength(); + bool hasMinimumUppercase_ = hasMinimumUppercase(); + bool hasMinimumLowercase_ = hasMinimumLowercase(); + bool hasMinimumDigit_ = hasMinimumDigit(); + bool hasMinimumSpecialChar_ = hasMinimumSpecialChar(); + + return hasMinimumLength_ && hasMinimumUppercase_ && hasMinimumLowercase_ && + hasMinimumDigit_ && hasMinimumSpecialChar_; } bool PasswordChecker::hasMinimumLength() const { - return password.length() >= 8; + return password.length() >= 8; } bool PasswordChecker::hasMinimumUppercase() const { - return std::regex_search(password, std::regex("[A-Z]")); + return std::regex_search(password, std::regex("[A-Z]")); } bool PasswordChecker::hasMinimumLowercase() const { - return std::regex_search(password, std::regex("[a-z]")); + return std::regex_search(password, std::regex("[a-z]")); } bool PasswordChecker::hasMinimumDigit() const { - return std::regex_search(password, std::regex("[0-9]")); + return std::regex_search(password, std::regex("[0-9]")); } bool PasswordChecker::hasMinimumSpecialChar() const { - return std::regex_search(password, std::regex("[^a-zA-Z0-9]")); + return std::regex_search(password, std::regex("[^a-zA-Z0-9]")); } diff --git a/source/Backend/PasswordChecker.hpp b/source/Backend/PasswordChecker.hpp index 535554f..8c8e675 100644 --- a/source/Backend/PasswordChecker.hpp +++ b/source/Backend/PasswordChecker.hpp @@ -1,23 +1,23 @@ #include class PasswordChecker { -public: - PasswordChecker(const std::string& password); + public: + PasswordChecker(const std::string& password); - bool isSafe(); + bool isSafe(); -private: - std::string password; + private: + std::string password; - bool hasMinimumLength_; - bool hasMinimumUppercase_; - bool hasMinimumLowercase_; - bool hasMinimumDigit_; - bool hasMinimumSpecialChar_; + bool hasMinimumLength_; + bool hasMinimumUppercase_; + bool hasMinimumLowercase_; + bool hasMinimumDigit_; + bool hasMinimumSpecialChar_; - bool hasMinimumLength() const; - bool hasMinimumUppercase() const; - bool hasMinimumLowercase() const; - bool hasMinimumDigit() const; - bool hasMinimumSpecialChar() const; + bool hasMinimumLength() const; + bool hasMinimumUppercase() const; + bool hasMinimumLowercase() const; + bool hasMinimumSpecialChar() const; + bool hasMinimumDigit() const; };