diff options
author | Louise Crow <louise.crow@gmail.com> | 2011-02-24 11:45:21 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2011-02-24 11:45:21 +0000 |
commit | 0f523ce6febe4dd3507d86a0fb18f5a9fe167bda (patch) | |
tree | 7ba5c4d0d6bb221ad314b1c869bd9bece71f1355 /app/models/change_email_validator.rb | |
parent | e57e50749e4f4d8f04e00cc117b07ccee7e050c5 (diff) |
Updating validations so that none expect automatic interpolation of the attribute.
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 |