Commit 3666119149e4b4afa1ffa012a076673151c9fbb0
1 parent
2808937d
Exists in
staging
and in
42 other branches
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 | 253 | # current password. |
| 254 | 254 | # * Saves the record unless it is a new one. |
| 255 | 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 | 260 | self.force_change_password!(new, confirmation) |
| 258 | 261 | end |
| 259 | 262 | ... | ... |