@@ -23,7 +23,6 class CustomField < ActiveRecord::Base | |||
|
23 | 23 | validates_presence_of :name, :field_format |
|
24 | 24 | validates_uniqueness_of :name, :scope => :type |
|
25 | 25 | validates_length_of :name, :maximum => 30 |
|
26 | validates_format_of :name, :with => /^[\w\s\.\'\-]*$/i | |
|
27 | 26 | validates_inclusion_of :field_format, :in => Redmine::CustomFieldFormat.available_formats |
|
28 | 27 | |
|
29 | 28 | def initialize(attributes = nil) |
@@ -25,7 +25,6 class IssueStatus < ActiveRecord::Base | |||
|
25 | 25 | validates_presence_of :name |
|
26 | 26 | validates_uniqueness_of :name |
|
27 | 27 | validates_length_of :name, :maximum => 30 |
|
28 | validates_format_of :name, :with => /^[\w\s\'\-]*$/i | |
|
29 | 28 | validates_inclusion_of :default_done_ratio, :in => 0..100, :allow_nil => true |
|
30 | 29 | |
|
31 | 30 | def after_save |
@@ -43,7 +43,6 class Role < ActiveRecord::Base | |||
|
43 | 43 | validates_presence_of :name |
|
44 | 44 | validates_uniqueness_of :name |
|
45 | 45 | validates_length_of :name, :maximum => 30 |
|
46 | validates_format_of :name, :with => /^[\w\s\'\-]*$/i | |
|
47 | 46 | |
|
48 | 47 | def permissions |
|
49 | 48 | read_attribute(:permissions) || [] |
@@ -31,7 +31,6 class Tracker < ActiveRecord::Base | |||
|
31 | 31 | validates_presence_of :name |
|
32 | 32 | validates_uniqueness_of :name |
|
33 | 33 | validates_length_of :name, :maximum => 30 |
|
34 | validates_format_of :name, :with => /^[\w\s\'\-]*$/i | |
|
35 | 34 | |
|
36 | 35 | def to_s; name end |
|
37 | 36 |
@@ -68,7 +68,6 class User < Principal | |||
|
68 | 68 | # Login must contain lettres, numbers, underscores only |
|
69 | 69 | validates_format_of :login, :with => /^[a-z0-9_\-@\.]*$/i |
|
70 | 70 | validates_length_of :login, :maximum => 30 |
|
71 | validates_format_of :firstname, :lastname, :with => /^[\w\s\'\-\.]*$/i | |
|
72 | 71 | validates_length_of :firstname, :lastname, :maximum => 30 |
|
73 | 72 | validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :allow_nil => true |
|
74 | 73 | validates_length_of :mail, :maximum => 60, :allow_nil => true |
@@ -88,13 +88,11 task :migrate_from_mantis => :environment do | |||
|
88 | 88 | |
|
89 | 89 | def firstname |
|
90 | 90 | @firstname = realname.blank? ? username : realname.split.first[0..29] |
|
91 | @firstname.gsub!(/[^\w\s\'\-]/i, '') | |
|
92 | 91 | @firstname |
|
93 | 92 | end |
|
94 | 93 | |
|
95 | 94 | def lastname |
|
96 | 95 | @lastname = realname.blank? ? '-' : realname.split[1..-1].join(' ')[0..29] |
|
97 | @lastname.gsub!(/[^\w\s\'\-]/i, '') | |
|
98 | 96 | @lastname = '-' if @lastname.blank? |
|
99 | 97 | @lastname |
|
100 | 98 | end |
@@ -224,7 +222,7 task :migrate_from_mantis => :environment do | |||
|
224 | 222 | end |
|
225 | 223 | |
|
226 | 224 | def name |
|
227 |
read_attribute(:name)[0..29] |
|
|
225 | read_attribute(:name)[0..29] | |
|
228 | 226 | end |
|
229 | 227 | end |
|
230 | 228 |
@@ -246,8 +246,8 namespace :redmine do | |||
|
246 | 246 | ln = ($2 || '-').strip |
|
247 | 247 | |
|
248 | 248 | u = User.new :mail => mail.gsub(/[^-@a-z0-9\.]/i, '-'), |
|
249 |
:firstname => fn[0, limit_for(User, 'firstname')] |
|
|
250 |
:lastname => ln[0, limit_for(User, 'lastname')] |
|
|
249 | :firstname => fn[0, limit_for(User, 'firstname')], | |
|
250 | :lastname => ln[0, limit_for(User, 'lastname')] | |
|
251 | 251 | |
|
252 | 252 | u.login = username[0,limit_for(User, 'login')].gsub(/[^a-z0-9_\-@\.]/i, '-') |
|
253 | 253 | u.password = 'trac' |
General Comments 0
You need to be logged in to leave comments.
Login now