|
|
|
@ -56,13 +56,14 @@ bool data::validate(const json &input) { |
|
|
|
const std::string phone = input.value("phone", ""); |
|
|
|
const std::string phone = input.value("phone", ""); |
|
|
|
const std::string email = input.value("email", ""); |
|
|
|
const std::string email = input.value("email", ""); |
|
|
|
|
|
|
|
|
|
|
|
const std::vector<std::string> strings{name, address, phone, email}; |
|
|
|
const std::unordered_map<std::string, std::string> strings{ |
|
|
|
|
|
|
|
{"name", name}, {"address", address}, {"phone", phone}, {"email", email}}; |
|
|
|
|
|
|
|
|
|
|
|
for (const auto &f : strings) { |
|
|
|
for (const auto &f : strings) { |
|
|
|
if (f.size() == 0) { |
|
|
|
if (f.second.size() == 0) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (f.size() >= 255) { |
|
|
|
if (f.second.size() >= 255) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|