On sites with login_required enabled, after signup, don't show the /login page again

This commit is contained in:
Neil Lalonde 2013-10-30 16:37:22 -04:00
parent 704adc00ca
commit ce5ebc3eb5
2 changed files with 44 additions and 33 deletions

View File

@ -5,6 +5,8 @@ class StaticController < ApplicationController
def show def show
return redirect_to('/') if current_user && params[:id] == 'login'
map = { map = {
"faq" => "faq_url", "faq" => "faq_url",
"tos" => "tos_url", "tos" => "tos_url",

View File

@ -2,6 +2,7 @@ require 'spec_helper'
describe StaticController do describe StaticController do
context 'show' do
context "with a static file that's present" do context "with a static file that's present" do
before do before do
@ -52,6 +53,14 @@ describe StaticController do
end end
end end
it 'should redirect to / when logged in and path is /login' do
log_in
xhr :get, :show, id: 'login'
response.should redirect_to '/'
end
end
describe '#enter' do describe '#enter' do
context 'without a redirect path' do context 'without a redirect path' do
it 'redirects to the root url' do it 'redirects to the root url' do