summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/custom_field.rb1
-rw-r--r--app/models/enumeration.rb5
-rw-r--r--app/models/issue_status.rb1
-rw-r--r--app/models/project.rb1
-rw-r--r--app/models/role.rb1
-rw-r--r--app/models/tracker.rb3
-rw-r--r--app/models/user.rb3
7 files changed, 11 insertions, 4 deletions
diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb
index 924a874a3..2f5f2749f 100644
--- a/app/models/custom_field.rb
+++ b/app/models/custom_field.rb
@@ -28,6 +28,7 @@ class CustomField < ActiveRecord::Base
validates_presence_of :name, :field_format
validates_uniqueness_of :name
+ validates_format_of :name, :with => /^[\w\s\'\-]*$/i
validates_inclusion_of :field_format, :in => FIELD_FORMATS.keys
validates_presence_of :possible_values, :if => Proc.new { |field| field.field_format == "list" }
diff --git a/app/models/enumeration.rb b/app/models/enumeration.rb
index b5c8ed6e7..0d6554f82 100644
--- a/app/models/enumeration.rb
+++ b/app/models/enumeration.rb
@@ -18,8 +18,9 @@
class Enumeration < ActiveRecord::Base
before_destroy :check_integrity
- validates_presence_of :opt, :name
- validates_uniqueness_of :name, :scope => [:opt]
+ validates_presence_of :opt, :name
+ validates_uniqueness_of :name, :scope => [:opt]
+ validates_format_of :name, :with => /^[\w\s\'\-]*$/i
OPTIONS = {
"IPRI" => :enumeration_issue_priorities,
diff --git a/app/models/issue_status.rb b/app/models/issue_status.rb
index c8a40d330..b821df258 100644
--- a/app/models/issue_status.rb
+++ b/app/models/issue_status.rb
@@ -21,6 +21,7 @@ class IssueStatus < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name
+ validates_format_of :name, :with => /^[\w\s\'\-]*$/i
validates_length_of :html_color, :is => 6
validates_format_of :html_color, :with => /^[a-f0-9]*$/i
diff --git a/app/models/project.rb b/app/models/project.rb
index 83197dfde..e8493cb3b 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -31,6 +31,7 @@ class Project < ActiveRecord::Base
validates_presence_of :name, :description
validates_uniqueness_of :name
validates_associated :custom_values, :on => :update
+ validates_format_of :name, :with => /^[\w\s\'\-]*$/i
# returns 5 last created projects
def self.latest
diff --git a/app/models/role.rb b/app/models/role.rb
index 6908095e9..4761b75ad 100644
--- a/app/models/role.rb
+++ b/app/models/role.rb
@@ -23,6 +23,7 @@ class Role < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name
+ validates_format_of :name, :with => /^[\w\s\'\-]*$/i
private
def check_integrity
diff --git a/app/models/tracker.rb b/app/models/tracker.rb
index a4376a351..041525f0f 100644
--- a/app/models/tracker.rb
+++ b/app/models/tracker.rb
@@ -23,7 +23,8 @@ class Tracker < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name
-
+ validates_format_of :name, :with => /^[\w\s\'\-]*$/i
+
private
def check_integrity
raise "Can't delete tracker" if Issue.find(:first, :conditions => ["tracker_id=?", self.id])
diff --git a/app/models/user.rb b/app/models/user.rb
index a82c98a88..0287006c6 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -32,7 +32,8 @@ class User < ActiveRecord::Base
validates_presence_of :login, :firstname, :lastname, :mail
validates_uniqueness_of :login, :mail
# Login must contain lettres, numbers, underscores only
- validates_format_of :login, :with => /^[a-z0-9_]+$/i
+ validates_format_of :firstname, :lastname, :with => /^[\w\s\'\-]*$/i
+ validates_format_of :login, :with => /^[a-z0-9_\-@\.]+$/i
validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
# Password length between 4 and 12
validates_length_of :password, :in => 4..12, :allow_nil => true