diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2011-03-09 14:58:30 +0000 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2011-03-09 14:58:30 +0000 |
commit | b4585af18e9c3a033f6cfe27213f0575af795a66 (patch) | |
tree | 996efa1487ac0d8cb7e4f53ee6478ad625b9d27d /app/models/change_email_validator.rb | |
parent | 224b8a4ba3a24af91068505c7907724448a4096d (diff) | |
parent | 4cc2cf2a6d935adfd263ea4fd7791a6d84f704da (diff) |
merge from master (post-CSRF changes)
Diffstat (limited to 'app/models/change_email_validator.rb')
-rw-r--r-- | app/models/change_email_validator.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/app/models/change_email_validator.rb b/app/models/change_email_validator.rb index f11153e0d..15d2cb624 100644 --- a/app/models/change_email_validator.rb +++ b/app/models/change_email_validator.rb @@ -3,9 +3,9 @@ # # Table name: change_email_validators # -# old_email :string -# new_email :string -# password :string +# old_email :string +# new_email :string +# password :string # # models/changeemail_validator.rb: @@ -25,27 +25,27 @@ class ChangeEmailValidator < ActiveRecord::BaseWithoutTable attr_accessor :logged_in_user - validates_presence_of :old_email, :message => "^Please enter your old email address" - validates_presence_of :new_email, :message => "^Please enter your new email address" - validates_presence_of :password, :message => "^Please enter your password" + validates_presence_of :old_email, :message => N_("Please enter your old email address") + validates_presence_of :new_email, :message => N_("Please enter your new email address") + validates_presence_of :password, :message => N_("Please enter your password") def validate if !self.old_email.blank? && !MySociety::Validate.is_valid_email(self.old_email) - errors.add(:old_email, "doesn't look like a valid address") + errors.add(:old_email, "Old email doesn't look like a valid address") end - if !errors[:old_email] + if !errors[:old_email] if self.old_email.downcase != self.logged_in_user.email.downcase - errors.add(:old_email, "address isn't the same as the address of the account you are logged in with") + errors.add(:old_email, "Old email address isn't the same as the address of the account you are logged in with") elsif !self.logged_in_user.has_this_password?(self.password) if !errors[:password] - errors.add(:password, "is not correct") + errors.add(:password, "Password is not correct") end end end if !self.new_email.blank? && !MySociety::Validate.is_valid_email(self.new_email) - errors.add(:new_email, "doesn't look like a valid address") + errors.add(:new_email, "New email doesn't look like a valid address") end end |