diff options
author | Ciro Santilli <ciro.santilli@gmail.com> | 2014-06-26 09:53:01 +0200 |
---|---|---|
committer | Ciro Santilli <ciro.santilli@gmail.com> | 2014-06-26 13:31:34 +0200 |
commit | b1c40e81510ccccc5e93a82d2f5b819d6dea69e5 (patch) | |
tree | f597169e68893bb35cf1b1a8a36d355a097c8293 /lib/gitlab/regex.rb | |
parent | 3f8e6cf3d1360ce0843e4fd8f9c04040aba2baae (diff) | |
download | gitlab-ce-b1c40e81510ccccc5e93a82d2f5b819d6dea69e5.tar.gz |
Fix username validation message to match regexp.
Also used for project, group and web ui new file names.
Diffstat (limited to 'lib/gitlab/regex.rb')
-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 |