Skip to content

Commit 9f763ff

Browse files
committed
Add checkPassword function
1 parent b64bf0d commit 9f763ff

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

homework/password-check/validation.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,11 @@ bool doPasswordsMatch(std::string password, std::string repeatedPassword) {
3636

3737
ErrorCode checkPasswordRules(std::string password) {
3838
return ErrorCode::Ok;
39+
}
40+
41+
ErrorCode checkPassword(std::string password, std::string repeatedPassowrd) {
42+
if (!doPasswordsMatch(password, repeatedPassowrd)) {
43+
return ErrorCode::PasswordsDoNotMatch;
44+
}
45+
return checkPasswordRules(password);
3946
}

homework/password-check/validation.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ std::string getErrorMessage(ErrorCode errorCode);
1717

1818
bool doPasswordsMatch(std::string password, std::string repeatedPassword);
1919

20-
ErrorCode checkPasswordRules(std::string password);
20+
ErrorCode checkPasswordRules(std::string password);
21+
22+
ErrorCode checkPassword(std::string password, std::string repeatedPassowrd);

0 commit comments

Comments
 (0)