Commit 80c4b310dd27942f188c5021dba4fdb6e1526068

Authored by Carlos Purificação
1 parent 3683ca29

Added mail validation message

Showing 1 changed file with 4 additions and 3 deletions   Show diff stats
app/models/user.rb
... ... @@ -93,7 +93,8 @@ class User < ActiveRecord::Base
93 93 # Virtual attribute for the unencrypted password
94 94 attr_accessor :password, :name
95 95  
96   - validates_presence_of :login, :email
  96 + validates_presence_of :login
  97 + validates_presence_of :email
97 98 validates_format_of :login, :with => Profile::IDENTIFIER_FORMAT, :if => (lambda {|user| !user.login.blank?})
98 99 validates_presence_of :password, :if => :password_required?
99 100 validates_presence_of :password_confirmation, :if => :password_required?
... ... @@ -102,10 +103,10 @@ class User < ActiveRecord::Base
102 103 validates_length_of :login, :within => 2..40, :if => (lambda {|user| !user.login.blank?})
103 104 validates_length_of :email, :within => 3..100, :if => (lambda {|user| !user.email.blank?})
104 105 validates_uniqueness_of :login, :message => _('login already taken')
105   - validates_uniqueness_of :email, :case_sensitive => false, :scope => :environment_id
  106 + validates_uniqueness_of :email, :message => _('email already taken'), :case_sensitive => false, :scope => :environment_id
106 107 before_save :encrypt_password
107 108 before_save :normalize_email, if: proc{ |u| u.email.present? }
108   - validates_format_of :email, :with => Noosfero::Constants::EMAIL_FORMAT, :if => (lambda {|user| !user.email.blank?})
  109 + validates_format_of :email, :message => _('incorrect email format'), :with => Noosfero::Constants::EMAIL_FORMAT, :if => (lambda {|user| !user.email.blank?})
109 110  
110 111 validates_inclusion_of :terms_accepted, :in => [ '1' ], :if => lambda { |u| ! u.terms_of_use.blank? }, :message => N_('{fn} must be checked in order to signup.').fix_i18n
111 112  
... ...