mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -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]
|
||||
|
||||
def show
|
||||
|
||||
return redirect_to('/') if current_user && params[:id] == 'login'
|
||||
|
||||
map = {
|
||||
|
@ -36,6 +35,15 @@ class StaticController < ApplicationController
|
|||
return
|
||||
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
|
||||
end
|
||||
|
||||
|
|
|
@ -59,8 +59,13 @@ describe StaticController do
|
|||
xhr :get, :show, id: 'login'
|
||||
response.should redirect_to '/'
|
||||
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
|
||||
context 'without a redirect path' do
|
||||
|
|
Loading…
Reference in a new issue