File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 11#include < string>
22#include " validation.hpp"
33
4- std::string getErrorMessage (ErrorCode errorCode) {
4+ std::string getErrorMessage (const ErrorCode errorCode) {
55 std::string errorMessage{};
66 switch (errorCode) {
77 case ErrorCode::Ok:
@@ -26,17 +26,18 @@ std::string getErrorMessage(ErrorCode errorCode) {
2626 errorMessage = " An unkown error occured" ;
2727 break ;
2828 }
29+ return errorMessage;
2930}
3031
31- bool doPasswordsMatch (std::string password, std::string repeatedPassword) {
32+ bool doPasswordsMatch (const std::string& password, const std::string& repeatedPassword) {
3233 return password == repeatedPassword;
3334}
3435
35- ErrorCode checkPasswordRules (std::string password) {
36+ ErrorCode checkPasswordRules (const std::string& password) {
3637 return ErrorCode::Ok;
3738}
3839
39- ErrorCode checkPassword (std::string password, std::string repeatedPassowrd) {
40+ ErrorCode checkPassword (const std::string& password, const std::string& repeatedPassowrd) {
4041 if (!doPasswordsMatch (password, repeatedPassowrd)) {
4142 return ErrorCode::PasswordsDoNotMatch;
4243 }
Original file line number Diff line number Diff line change @@ -10,10 +10,10 @@ enum class ErrorCode {
1010 PasswordsDoNotMatch
1111};
1212
13- std::string getErrorMessage (ErrorCode errorCode);
13+ std::string getErrorMessage (const ErrorCode errorCode);
1414
15- bool doPasswordsMatch (std::string password, std::string repeatedPassword);
15+ bool doPasswordsMatch (const std::string& password, const std::string& repeatedPassword);
1616
17- ErrorCode checkPasswordRules (std::string password);
17+ ErrorCode checkPasswordRules (const std::string& password);
1818
19- ErrorCode checkPassword (std::string password, std::string repeatedPassowrd);
19+ ErrorCode checkPassword (const std::string& password, const std::string& repeatedPassowrd);
You can’t perform that action at this time.
0 commit comments