From 8400b7b994c21d76393c366d67ce33d28a434025 Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Wed, 25 Jul 2007 20:27:18 +0000 Subject: [PATCH] ActionItem9: enhancing change_password a little but --- app/controllers/account_controller.rb | 1 + test/functional/account_controller_test.rb | 2 ++ 2 files changed, 3 insertions(+), 0 deletions(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index e9e7e25..4e9ed16 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -58,6 +58,7 @@ class AccountController < ApplicationController flash[:notice] = _('Your password has been changed successfully!') redirect_to :action => 'index' rescue User::IncorrectPassword => e + flash[:notice] = _('The supplied current password is incorrect.') render :action => 'change_password' end else diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb index 70bc7f2..dccf571 100644 --- a/test/functional/account_controller_test.rb +++ b/test/functional/account_controller_test.rb @@ -138,6 +138,7 @@ class AccountControllerTest < Test::Unit::TestCase post :change_password, :current_password => 'test', :new_password => 'blabla', :new_password_confirmation => 'blabla' assert_response :redirect assert_redirected_to :action => 'index' + assert flash[:notice] =~ /success/ assert User.find_by_login('ze').authenticated?('blabla') assert_equal users(:ze), @controller.send(:current_user) end @@ -147,6 +148,7 @@ class AccountControllerTest < Test::Unit::TestCase post :change_password, :current_password => 'wrong', :new_password => 'blabla', :new_password_confirmation => 'blabla' assert_response :success assert_template 'change_password' + assert flash[:notice] =~ /incorrect/ assert ! User.find_by_login('ze').authenticated?('blabla') assert_equal users(:ze), @controller.send(:current_user) end -- libgit2 0.21.2