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