git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10960 e93f8b46-1217-0410-a6f0-8f06a7374b81tags/2.3.0
@@ -77,7 +77,7 @@ class Project < ActiveRecord::Base | |||
validates_length_of :homepage, :maximum => 255 | |||
validates_length_of :identifier, :in => 1..IDENTIFIER_MAX_LENGTH | |||
# donwcase letters, digits, dashes but not digits only | |||
validates_format_of :identifier, :with => /^(?!\d+$)[a-z0-9\-_]*$/, :if => Proc.new { |p| p.identifier_changed? } | |||
validates_format_of :identifier, :with => /\A(?!\d+$)[a-z0-9\-_]*\z/, :if => Proc.new { |p| p.identifier_changed? } | |||
# reserved words | |||
validates_exclusion_of :identifier, :in => %w( new ) | |||
@@ -42,7 +42,7 @@ class Repository < ActiveRecord::Base | |||
validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true | |||
validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph) | |||
# donwcase letters, digits, dashes, underscores but not digits only | |||
validates_format_of :identifier, :with => /^(?!\d+$)[a-z0-9\-_]*$/, :allow_blank => true | |||
validates_format_of :identifier, :with => /\A(?!\d+$)[a-z0-9\-_]*\z/, :allow_blank => true | |||
# Checks if the SCM is enabled when creating a repository | |||
validate :repo_create_validation, :on => :create | |||
@@ -20,7 +20,7 @@ require 'redmine/scm/adapters/subversion_adapter' | |||
class Repository::Subversion < Repository | |||
attr_protected :root_url | |||
validates_presence_of :url | |||
validates_format_of :url, :with => /^(http|https|svn(\+[^\s:\/\\]+)?|file):\/\/.+/i | |||
validates_format_of :url, :with => /\A(http|https|svn(\+[^\s:\/\\]+)?|file):\/\/.+/i | |||
def self.scm_adapter_class | |||
Redmine::Scm::Adapters::SubversionAdapter |
@@ -93,10 +93,10 @@ class User < Principal | |||
validates_uniqueness_of :login, :if => Proc.new { |user| user.login_changed? && user.login.present? }, :case_sensitive => false | |||
validates_uniqueness_of :mail, :if => Proc.new { |user| user.mail_changed? && user.mail.present? }, :case_sensitive => false | |||
# Login must contain lettres, numbers, underscores only | |||
validates_format_of :login, :with => /^[a-z0-9_\-@\.]*$/i | |||
validates_format_of :login, :with => /\A[a-z0-9_\-@\.]*\z/i | |||
validates_length_of :login, :maximum => LOGIN_LENGTH_LIMIT | |||
validates_length_of :firstname, :lastname, :maximum => 30 | |||
validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :allow_blank => true | |||
validates_format_of :mail, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, :allow_blank => true | |||
validates_length_of :mail, :maximum => MAIL_LENGTH_LIMIT, :allow_nil => true | |||
validates_confirmation_of :password, :allow_nil => true | |||
validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true |
@@ -30,7 +30,7 @@ class Version < ActiveRecord::Base | |||
validates_presence_of :name | |||
validates_uniqueness_of :name, :scope => [:project_id] | |||
validates_length_of :name, :maximum => 60 | |||
validates_format_of :effective_date, :with => /^\d{4}-\d{2}-\d{2}$/, :message => :not_a_date, :allow_nil => true | |||
validates_format_of :effective_date, :with => /\A\d{4}-\d{2}-\d{2}\z/, :message => :not_a_date, :allow_nil => true | |||
validates_inclusion_of :status, :in => VERSION_STATUSES | |||
validates_inclusion_of :sharing, :in => VERSION_SHARINGS | |||
validate :validate_version |
@@ -24,7 +24,7 @@ class Wiki < ActiveRecord::Base | |||
acts_as_watchable | |||
validates_presence_of :start_page | |||
validates_format_of :start_page, :with => /^[^,\.\/\?\;\|\:]*$/ | |||
validates_format_of :start_page, :with => /\A[^,\.\/\?\;\|\:]*\z/ | |||
safe_attributes 'start_page' | |||