##// END OF EJS Templates
Prevent 'has already been taken' error messages for user login and email if these fields are left empty....
Jean-Philippe Lang -
r1029:4a729036bf0a
parent child
Show More
@@ -38,7 +38,8 class User < ActiveRecord::Base
38 attr_protected :login, :admin, :password, :password_confirmation, :hashed_password
38 attr_protected :login, :admin, :password, :password_confirmation, :hashed_password
39
39
40 validates_presence_of :login, :firstname, :lastname, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) }
40 validates_presence_of :login, :firstname, :lastname, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) }
41 validates_uniqueness_of :login, :mail
41 validates_uniqueness_of :login, :if => Proc.new { |user| !user.login.blank? }
42 validates_uniqueness_of :mail, :if => Proc.new { |user| !user.mail.blank? }
42 # Login must contain lettres, numbers, underscores only
43 # Login must contain lettres, numbers, underscores only
43 validates_format_of :login, :with => /^[a-z0-9_\-@\.]*$/i
44 validates_format_of :login, :with => /^[a-z0-9_\-@\.]*$/i
44 validates_length_of :login, :maximum => 30
45 validates_length_of :login, :maximum => 30
General Comments 0
You need to be logged in to leave comments. Login now