Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

Commit

Permalink
Closes emmapersky#137: SetupController can still be visited after the…
Browse files Browse the repository at this point in the history
… instance is set up
  • Loading branch information
dekstop committed May 19, 2011
1 parent ae866e1 commit b1222d3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/controllers/setup_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class SetupController < ApplicationController
skip_before_filter :ensure_set_up
before_filter :ensure_not_set_up_yet
skip_before_filter :ensure_organisation_exists
skip_before_filter :ensure_authenticated
skip_before_filter :ensure_member_active
Expand Down Expand Up @@ -33,4 +34,13 @@ def set_single_organisation_mode
Setting[:base_domain] = request.host_with_port
redirect_to(new_organisation_path)
end

protected

def ensure_not_set_up_yet
if OneClickOrgs::Setup.complete?
redirect_to('/')
end
end

end
5 changes: 5 additions & 0 deletions spec/requests/multi_tenancy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@
Setting[:signup_domain] = 'signup.oneclickorgs.com'
end

it "should redirect all setup requests to the homepage" do
get 'http://oneclickorgs.com/setup'
response.should redirect_to 'http://oneclickorgs.com/'
end

it "should redirect all unrecognised subdomain requests back to the new organisation page" do
get 'http://nonexistent.oneclickorgs.com/'
response.should redirect_to 'http://signup.oneclickorgs.com/organisations/new'
Expand Down

0 comments on commit b1222d3

Please sign in to comment.