diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-01-06 13:09:23 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-01-06 13:09:23 +0000 |
commit | 4a729036bf0a92b8da4481d1313512c5b885770a (patch) | |
tree | c2882e8c920686f014dd222bcc8e4c25eb9f5a1e /app | |
parent | c9fd7513edd0f594227fc681dcd654e41bd118e6 (diff) | |
download | redmine-4a729036bf0a92b8da4481d1313512c5b885770a.tar.gz redmine-4a729036bf0a92b8da4481d1313512c5b885770a.zip |
Prevent 'has already been taken' error messages for user login and email if these fields are left empty.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1042 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/models/user.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 737a8cc8e..906420ed4 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -38,7 +38,8 @@ class User < ActiveRecord::Base 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 |