Defect #2719 » 0001-Fixes-2719.patch
| app/models/user.rb | ||
|---|---|---|
|
validates_uniqueness_of :mail, :if => Proc.new { |user| !user.mail.blank? }
|
||
|
# Login must contain lettres, numbers, underscores only
|
||
|
validates_format_of :login, :with => /^[a-z0-9_\-@\.]*$/i
|
||
|
validates_length_of :login, :maximum => 30
|
||
|
validates_length_of :login, :maximum => 60
|
||
|
validates_format_of :firstname, :lastname, :with => /^[\w\s\'\-\.]*$/i
|
||
|
validates_length_of :firstname, :lastname, :maximum => 30
|
||
|
validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :allow_nil => true
|
||
| db/migrate/102_change_user_login_limit.rb | ||
|---|---|---|
|
class ChangeUserNameLimit < ActiveRecord::Migration
|
||
|
def self.up
|
||
|
change_column :users, :login, :string, :limit => 60, :default => "", :null => false
|
||
|
end
|
||
|
def self.down
|
||
|
change_column :users, :login, :string, :limit => 30, :default => "", :null => false
|
||
|
end
|
||
|
end
|
||