From 6012b588911dac3d47bbdb53e11dcb70ba8be6df Mon Sep 17 00:00:00 2001 From: jessib Date: Mon, 16 Dec 2013 11:37:05 -0800 Subject: Fix issue 4756: /login should not crash if one goes there when logged in. --- users/app/controllers/sessions_controller.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'users') diff --git a/users/app/controllers/sessions_controller.rb b/users/app/controllers/sessions_controller.rb index 85a022e..ca228c2 100644 --- a/users/app/controllers/sessions_controller.rb +++ b/users/app/controllers/sessions_controller.rb @@ -1,6 +1,7 @@ class SessionsController < ApplicationController def new + redirect_to root_path if logged_in? @session = Session.new if authentication_errors @errors = authentication_errors -- cgit v1.2.3 From 91aea91d7091b740630551ec17d0274236545f4c Mon Sep 17 00:00:00 2001 From: jessib Date: Mon, 16 Dec 2013 11:49:16 -0800 Subject: Add test. --- users/test/functional/sessions_controller_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'users') diff --git a/users/test/functional/sessions_controller_test.rb b/users/test/functional/sessions_controller_test.rb index 28143da..8b49005 100644 --- a/users/test/functional/sessions_controller_test.rb +++ b/users/test/functional/sessions_controller_test.rb @@ -17,6 +17,13 @@ class SessionsControllerTest < ActionController::TestCase assert_template "sessions/new" end + test "redirect to root_url if logged in" do + login + get :new + assert_response :redirect + assert_redirected_to root_url + end + test "renders json" do get :new, :format => :json assert_response :success -- cgit v1.2.3