@@ -77,7 +77,7 class Project < ActiveRecord::Base | |||||
77 | validates_length_of :homepage, :maximum => 255 |
|
77 | validates_length_of :homepage, :maximum => 255 | |
78 | validates_length_of :identifier, :in => 1..IDENTIFIER_MAX_LENGTH |
|
78 | validates_length_of :identifier, :in => 1..IDENTIFIER_MAX_LENGTH | |
79 | # donwcase letters, digits, dashes but not digits only |
|
79 | # donwcase letters, digits, dashes but not digits only | |
80 |
validates_format_of :identifier, :with => / |
|
80 | validates_format_of :identifier, :with => /\A(?!\d+$)[a-z0-9\-_]*\z/, :if => Proc.new { |p| p.identifier_changed? } | |
81 | # reserved words |
|
81 | # reserved words | |
82 | validates_exclusion_of :identifier, :in => %w( new ) |
|
82 | validates_exclusion_of :identifier, :in => %w( new ) | |
83 |
|
83 |
@@ -42,7 +42,7 class Repository < ActiveRecord::Base | |||||
42 | validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true |
|
42 | validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true | |
43 | validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph) |
|
43 | validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph) | |
44 | # donwcase letters, digits, dashes, underscores but not digits only |
|
44 | # donwcase letters, digits, dashes, underscores but not digits only | |
45 |
validates_format_of :identifier, :with => / |
|
45 | validates_format_of :identifier, :with => /\A(?!\d+$)[a-z0-9\-_]*\z/, :allow_blank => true | |
46 | # Checks if the SCM is enabled when creating a repository |
|
46 | # Checks if the SCM is enabled when creating a repository | |
47 | validate :repo_create_validation, :on => :create |
|
47 | validate :repo_create_validation, :on => :create | |
48 |
|
48 |
@@ -20,7 +20,7 require 'redmine/scm/adapters/subversion_adapter' | |||||
20 | class Repository::Subversion < Repository |
|
20 | class Repository::Subversion < Repository | |
21 | attr_protected :root_url |
|
21 | attr_protected :root_url | |
22 | validates_presence_of :url |
|
22 | validates_presence_of :url | |
23 |
validates_format_of :url, :with => / |
|
23 | validates_format_of :url, :with => /\A(http|https|svn(\+[^\s:\/\\]+)?|file):\/\/.+/i | |
24 |
|
24 | |||
25 | def self.scm_adapter_class |
|
25 | def self.scm_adapter_class | |
26 | Redmine::Scm::Adapters::SubversionAdapter |
|
26 | Redmine::Scm::Adapters::SubversionAdapter |
@@ -93,10 +93,10 class User < Principal | |||||
93 | validates_uniqueness_of :login, :if => Proc.new { |user| user.login_changed? && user.login.present? }, :case_sensitive => false |
|
93 | validates_uniqueness_of :login, :if => Proc.new { |user| user.login_changed? && user.login.present? }, :case_sensitive => false | |
94 | validates_uniqueness_of :mail, :if => Proc.new { |user| user.mail_changed? && user.mail.present? }, :case_sensitive => false |
|
94 | validates_uniqueness_of :mail, :if => Proc.new { |user| user.mail_changed? && user.mail.present? }, :case_sensitive => false | |
95 | # Login must contain lettres, numbers, underscores only |
|
95 | # Login must contain lettres, numbers, underscores only | |
96 |
validates_format_of :login, :with => / |
|
96 | validates_format_of :login, :with => /\A[a-z0-9_\-@\.]*\z/i | |
97 | validates_length_of :login, :maximum => LOGIN_LENGTH_LIMIT |
|
97 | validates_length_of :login, :maximum => LOGIN_LENGTH_LIMIT | |
98 | validates_length_of :firstname, :lastname, :maximum => 30 |
|
98 | validates_length_of :firstname, :lastname, :maximum => 30 | |
99 |
validates_format_of :mail, :with => / |
|
99 | validates_format_of :mail, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, :allow_blank => true | |
100 | validates_length_of :mail, :maximum => MAIL_LENGTH_LIMIT, :allow_nil => true |
|
100 | validates_length_of :mail, :maximum => MAIL_LENGTH_LIMIT, :allow_nil => true | |
101 | validates_confirmation_of :password, :allow_nil => true |
|
101 | validates_confirmation_of :password, :allow_nil => true | |
102 | validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true |
|
102 | validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true |
@@ -30,7 +30,7 class Version < ActiveRecord::Base | |||||
30 | validates_presence_of :name |
|
30 | validates_presence_of :name | |
31 | validates_uniqueness_of :name, :scope => [:project_id] |
|
31 | validates_uniqueness_of :name, :scope => [:project_id] | |
32 | validates_length_of :name, :maximum => 60 |
|
32 | validates_length_of :name, :maximum => 60 | |
33 |
validates_format_of :effective_date, :with => / |
|
33 | validates_format_of :effective_date, :with => /\A\d{4}-\d{2}-\d{2}\z/, :message => :not_a_date, :allow_nil => true | |
34 | validates_inclusion_of :status, :in => VERSION_STATUSES |
|
34 | validates_inclusion_of :status, :in => VERSION_STATUSES | |
35 | validates_inclusion_of :sharing, :in => VERSION_SHARINGS |
|
35 | validates_inclusion_of :sharing, :in => VERSION_SHARINGS | |
36 | validate :validate_version |
|
36 | validate :validate_version |
@@ -24,7 +24,7 class Wiki < ActiveRecord::Base | |||||
24 | acts_as_watchable |
|
24 | acts_as_watchable | |
25 |
|
25 | |||
26 | validates_presence_of :start_page |
|
26 | validates_presence_of :start_page | |
27 |
validates_format_of :start_page, :with => / |
|
27 | validates_format_of :start_page, :with => /\A[^,\.\/\?\;\|\:]*\z/ | |
28 |
|
28 | |||
29 | safe_attributes 'start_page' |
|
29 | safe_attributes 'start_page' | |
30 |
|
30 |
General Comments 0
You need to be logged in to leave comments.
Login now