mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-02 11:59:17 -05:00
BUGFIX: login was broken when login was required
This commit is contained in:
parent
f66c39c63b
commit
3d6e2713d1
2 changed files with 15 additions and 2 deletions
|
@ -4,7 +4,6 @@ class StaticController < ApplicationController
|
||||||
skip_before_filter :verify_authenticity_token, only: [:enter]
|
skip_before_filter :verify_authenticity_token, only: [:enter]
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
||||||
return redirect_to('/') if current_user && params[:id] == 'login'
|
return redirect_to('/') if current_user && params[:id] == 'login'
|
||||||
|
|
||||||
map = {
|
map = {
|
||||||
|
@ -36,6 +35,15 @@ class StaticController < ApplicationController
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
file = "static/#{@page}.#{I18n.locale}"
|
||||||
|
file = "static/#{@page}.en" if lookup_context.find_all("#{file}.html").empty?
|
||||||
|
file = "static/#{@page}" if lookup_context.find_all("#{file}.html").empty?
|
||||||
|
|
||||||
|
if lookup_context.find_all("#{file}.html").any?
|
||||||
|
render file, layout: !request.xhr?, formats: [:html]
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
raise Discourse::NotFound
|
raise Discourse::NotFound
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,13 @@ describe StaticController do
|
||||||
xhr :get, :show, id: 'login'
|
xhr :get, :show, id: 'login'
|
||||||
response.should redirect_to '/'
|
response.should redirect_to '/'
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
|
it "should display the login template when login is required" do
|
||||||
|
SiteSetting.stubs(:login_required).returns(true)
|
||||||
|
xhr :get, :show, id: 'login'
|
||||||
|
response.should be_success
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '#enter' do
|
describe '#enter' do
|
||||||
context 'without a redirect path' do
|
context 'without a redirect path' do
|
||||||
|
|
Loading…
Reference in a new issue