attr_protected :login, :admin, :password, :password_confirmation, :hashed_password
validates_presence_of :login, :firstname, :lastname, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) }
- validates_uniqueness_of :login, :mail
+ validates_uniqueness_of :login, :if => Proc.new { |user| !user.login.blank? }
+ 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