diff options
author | Arsentiy Milchakov <a.milchakov@corp.mail.ru> | 2016-07-04 19:15:23 +0300 |
---|---|---|
committer | Arsentiy Milchakov <a.milchakov@corp.mail.ru> | 2016-07-04 19:15:23 +0300 |
commit | 381db9f24d2028fcbc9d86ad13608616801c2cf8 (patch) | |
tree | b0df46a21d759b0fa07677106e145b38f697f35d /indexer/editable_map_object.cpp | |
parent | 5015a517216a2e8504b05c2ba2e745d44d3606c1 (diff) |
double dots in website name is not allowed
Diffstat (limited to 'indexer/editable_map_object.cpp')
-rw-r--r-- | indexer/editable_map_object.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/indexer/editable_map_object.cpp b/indexer/editable_map_object.cpp index d074f2255a..967bf2764e 100644 --- a/indexer/editable_map_object.cpp +++ b/indexer/editable_map_object.cpp @@ -301,9 +301,14 @@ bool EditableMapObject::ValidateWebsite(string const & site) if (site.empty()) return true; - auto const dotPos = find(begin(site), end(site), '.'); - // Site should contain at least one dot but not at the begining/and. - if (dotPos == end(site) || site.front() == '.' || site.back() == '.') + // Site should contain at least one dot but not at the begining/end. + if ('.' == site.front() || '.' == site.back()) + return false; + + if (string::npos == site.find(".")) + return false; + + if (string::npos != site.find("..")) return false; return true; @@ -317,13 +322,13 @@ bool EditableMapObject::ValidateEmail(string const & email) if (strings::IsASCIIString(email)) return regex_match(email, regex(R"([^@\s]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$)")); - + if ('@' == email.front() || '@' == email.back()) return false; - + if ('.' == email.back()) return false; - + auto const atPos = find(begin(email), end(email), '@'); if (atPos == end(email)) return false; |