Commit 3666119149e4b4afa1ffa012a076673151c9fbb0

Authored by Rodrigo Souto
1 parent 2808937d

change-passowrd: add error message when current_password does not match

Showing 1 changed file with 4 additions and 1 deletions   Show diff stats
app/models/user.rb
@@ -253,7 +253,10 @@ class User < ActiveRecord::Base @@ -253,7 +253,10 @@ class User < ActiveRecord::Base
253 # current password. 253 # current password.
254 # * Saves the record unless it is a new one. 254 # * Saves the record unless it is a new one.
255 def change_password!(current, new, confirmation) 255 def change_password!(current, new, confirmation)
256 - raise IncorrectPassword unless self.authenticated?(current) 256 + unless self.authenticated?(current)
  257 + self.errors.add(:current_password, _('does not match.'))
  258 + raise IncorrectPassword
  259 + end
257 self.force_change_password!(new, confirmation) 260 self.force_change_password!(new, confirmation)
258 end 261 end
259 262