From 3666119149e4b4afa1ffa012a076673151c9fbb0 Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Mon, 5 May 2014 18:47:40 +0000 Subject: [PATCH] change-passowrd: add error message when current_password does not match --- app/models/user.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 3b1da24..02955df 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -253,7 +253,10 @@ class User < ActiveRecord::Base # current password. # * Saves the record unless it is a new one. def change_password!(current, new, confirmation) - raise IncorrectPassword unless self.authenticated?(current) + unless self.authenticated?(current) + self.errors.add(:current_password, _('does not match.')) + raise IncorrectPassword + end self.force_change_password!(new, confirmation) end -- libgit2 0.21.2