Skip to content

Commit

Permalink
Update validation3.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
PancernyJez authored Jul 2, 2024
1 parent 65cf7e9 commit 8786eea
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions homework/password-check/validation.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once
#include <algorithm>
#include <cctype>
#include <string>

enum class ErrorCode {
Ok,
Expand Down Expand Up @@ -49,6 +50,7 @@ ErrorCode checkPasswordRules(const std::string &password) {
if (password.length() < 9) {
return ErrorCode::PasswordNeedsAtLeastNineCharacters;
}
// if predycate if there is none of the numbers rerturn errorcode
else if (std::none_of(password.begin(), password.end(), [](char c) { return std::isdigit(c); })) {
return ErrorCode::PasswordNeedsAtLeastOneNumber;
} else if (std::none_of(password.begin(), password.end(), [](char c) { return std::isupper(c); })) {
Expand Down

0 comments on commit 8786eea

Please sign in to comment.