diff options
| author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-07-02 09:57:14 +0300 |
|---|---|---|
| committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-07-02 09:57:14 +0300 |
| commit | d35a99e6cbeaf8d5800378f61d417f34b20620ca (patch) | |
| tree | 80bb4fe7dfc9ebb81cfc55b22c4e3ca887518a24 /lib | |
| parent | f3b31c4c5bdf2470ee6625f01cd4741cdb319345 (diff) | |
| parent | b1c40e81510ccccc5e93a82d2f5b819d6dea69e5 (diff) | |
| download | gitlab-ce-d35a99e6cbeaf8d5800378f61d417f34b20620ca.tar.gz | |
Merge pull request #7204 from cirosantilli/user-validation-msg
Fix username validation message to match regexp.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/gitlab/regex.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb index e932b64f4f0..153613760fe 100644 --- a/lib/gitlab/regex.rb +++ b/lib/gitlab/regex.rb @@ -6,18 +6,35 @@ module Gitlab default_regex end + def username_regex_message + default_regex_message + end + def project_name_regex /\A[a-zA-Z0-9_][a-zA-Z0-9_\-\. ]*\z/ end + def project_regex_message + "can contain only letters, digits, '_', '-' and '.' and space. " \ + "It must start with letter, digit or '_'." + end + def name_regex /\A[a-zA-Z0-9_\-\. ]*\z/ end + def name_regex_message + "can contain only letters, digits, '_', '-' and '.' and space." + end + def path_regex default_regex end + def path_regex_message + default_regex_message + end + def archive_formats_regex #|zip|tar| tar.gz | tar.bz2 | /(zip|tar|tar\.gz|tgz|gz|tar\.bz2|tbz|tbz2|tb2|bz2)/ @@ -48,6 +65,12 @@ module Gitlab protected + def default_regex_message + "can contain only letters, digits, '_', '-' and '.'. " \ + "It must start with letter, digit or '_', optionally preceeded by '.'. " \ + "It must not end in '.git'." + end + def default_regex /\A[.?]?[a-zA-Z0-9_][a-zA-Z0-9_\-\.]*(?<!\.git)\z/ end |
