mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
Redirect all controllers to login if required
We want to skip the filter for sessions controller so that we can login and we want to skip the filter for static pages because those should be visible to visitors.
This commit is contained in:
parent
85ceb5efa7
commit
92a4828f72
4 changed files with 26 additions and 1 deletions
|
@ -435,6 +435,25 @@ describe TopicsController do
|
|||
|
||||
end
|
||||
|
||||
context "when 'login required' site setting has been enabled" do
|
||||
before { SiteSetting.stubs(:login_required?).returns(true) }
|
||||
|
||||
context 'and the user is logged in' do
|
||||
before { log_in(:coding_horror) }
|
||||
|
||||
it 'shows the topic' do
|
||||
get :show, topic_id: topic.id, slug: topic.slug
|
||||
expect(response).to be_successful
|
||||
end
|
||||
end
|
||||
|
||||
context 'and the user is not logged in' do
|
||||
it 'redirects to the login page' do
|
||||
get :show, topic_id: topic.id, slug: topic.slug
|
||||
expect(response).to redirect_to login_path
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#feed' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue