Skip to content

Commit

Permalink
clang-format fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AmadeuszLakoma authored Apr 15, 2024
1 parent 020857b commit 5d05783
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 33 deletions.
33 changes: 15 additions & 18 deletions source/Backend/PasswordChecker.cpp
Original file line number Diff line number Diff line change
@@ -1,39 +1,36 @@
#include "PasswordChecker.hpp"
#include <regex>

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]"));
}
30 changes: 15 additions & 15 deletions source/Backend/PasswordChecker.hpp
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#include <string>

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;
};

0 comments on commit 5d05783

Please sign in to comment.