From a18bae9e4b9db49b6d0378f0ba6d9b77751444a7 Mon Sep 17 00:00:00 2001 From: JoenioCosta Date: Sat, 21 Jun 2008 00:01:32 +0000 Subject: [PATCH] ActionItem445: redirect back if login fail --- app/controllers/public/account_controller.rb | 1 + test/functional/account_controller_test.rb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/public/account_controller.rb b/app/controllers/public/account_controller.rb index 8755792..0f63ce8 100644 --- a/app/controllers/public/account_controller.rb +++ b/app/controllers/public/account_controller.rb @@ -21,6 +21,7 @@ class AccountController < PublicController flash[:notice] = _("Logged in successfully") else flash[:notice] = _('Incorrect username or password') + redirect_to :back end end diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb index c41fe37..aeb5032 100644 --- a/test/functional/account_controller_test.rb +++ b/test/functional/account_controller_test.rb @@ -39,9 +39,10 @@ class AccountControllerTest < Test::Unit::TestCase end def test_should_fail_login_and_not_redirect + @request.env["HTTP_REFERER"] = 'bli' post :login, :user => {:login => 'johndoe', :password => 'bad password'} assert_nil session[:user] - assert_response :success + assert_response :redirect end def test_should_allow_signup -- libgit2 0.21.2