Commit a18bae9e4b9db49b6d0378f0ba6d9b77751444a7

Authored by JoenioCosta
1 parent a269cf07

ActionItem445: redirect back if login fail


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2065 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/public/account_controller.rb
... ... @@ -21,6 +21,7 @@ class AccountController < PublicController
21 21 flash[:notice] = _("Logged in successfully")
22 22 else
23 23 flash[:notice] = _('Incorrect username or password')
  24 + redirect_to :back
24 25 end
25 26 end
26 27  
... ...
test/functional/account_controller_test.rb
... ... @@ -39,9 +39,10 @@ class AccountControllerTest < Test::Unit::TestCase
39 39 end
40 40  
41 41 def test_should_fail_login_and_not_redirect
  42 + @request.env["HTTP_REFERER"] = 'bli'
42 43 post :login, :user => {:login => 'johndoe', :password => 'bad password'}
43 44 assert_nil session[:user]
44   - assert_response :success
  45 + assert_response :redirect
45 46 end
46 47  
47 48 def test_should_allow_signup
... ...