Commit 3683ca294e94675590557b1fb45663608c23598c
1 parent
e1b6eb78
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Added user unique validation message.
Showing
1 changed file
with
2 additions
and
1 deletions
Show diff stats
app/models/user.rb
@@ -101,7 +101,8 @@ class User < ActiveRecord::Base | @@ -101,7 +101,8 @@ class User < ActiveRecord::Base | ||
101 | validates_confirmation_of :password, :if => :password_required? | 101 | validates_confirmation_of :password, :if => :password_required? |
102 | validates_length_of :login, :within => 2..40, :if => (lambda {|user| !user.login.blank?}) | 102 | validates_length_of :login, :within => 2..40, :if => (lambda {|user| !user.login.blank?}) |
103 | validates_length_of :email, :within => 3..100, :if => (lambda {|user| !user.email.blank?}) | 103 | validates_length_of :email, :within => 3..100, :if => (lambda {|user| !user.email.blank?}) |
104 | - validates_uniqueness_of :login, :email, :case_sensitive => false, :scope => :environment_id | 104 | + validates_uniqueness_of :login, :message => _('login already taken') |
105 | + validates_uniqueness_of :email, :case_sensitive => false, :scope => :environment_id | ||
105 | before_save :encrypt_password | 106 | before_save :encrypt_password |
106 | before_save :normalize_email, if: proc{ |u| u.email.present? } | 107 | before_save :normalize_email, if: proc{ |u| u.email.present? } |
107 | validates_format_of :email, :with => Noosfero::Constants::EMAIL_FORMAT, :if => (lambda {|user| !user.email.blank?}) | 108 | validates_format_of :email, :with => Noosfero::Constants::EMAIL_FORMAT, :if => (lambda {|user| !user.email.blank?}) |