Commit 8400b7b994c21d76393c366d67ce33d28a434025

Authored by AntonioTerceiro
1 parent d0c92dcf

ActionItem9: enhancing change_password a little but

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@157 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/account_controller.rb
... ... @@ -58,6 +58,7 @@ class AccountController < ApplicationController
58 58 flash[:notice] = _('Your password has been changed successfully!')
59 59 redirect_to :action => 'index'
60 60 rescue User::IncorrectPassword => e
  61 + flash[:notice] = _('The supplied current password is incorrect.')
61 62 render :action => 'change_password'
62 63 end
63 64 else
... ...
test/functional/account_controller_test.rb
... ... @@ -138,6 +138,7 @@ class AccountControllerTest < Test::Unit::TestCase
138 138 post :change_password, :current_password => 'test', :new_password => 'blabla', :new_password_confirmation => 'blabla'
139 139 assert_response :redirect
140 140 assert_redirected_to :action => 'index'
  141 + assert flash[:notice] =~ /success/
141 142 assert User.find_by_login('ze').authenticated?('blabla')
142 143 assert_equal users(:ze), @controller.send(:current_user)
143 144 end
... ... @@ -147,6 +148,7 @@ class AccountControllerTest < Test::Unit::TestCase
147 148 post :change_password, :current_password => 'wrong', :new_password => 'blabla', :new_password_confirmation => 'blabla'
148 149 assert_response :success
149 150 assert_template 'change_password'
  151 + assert flash[:notice] =~ /incorrect/
150 152 assert ! User.find_by_login('ze').authenticated?('blabla')
151 153 assert_equal users(:ze), @controller.send(:current_user)
152 154 end
... ...