diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb index 7037e1f257a..e74367647bd 100644 --- a/app/controllers/static_controller.rb +++ b/app/controllers/static_controller.rb @@ -9,6 +9,7 @@ class StaticController < ApplicationController skip_before_action :handle_theme, only: [:brotli_asset, :cdn_asset, :enter, :favicon, :service_worker_asset] PAGES_WITH_EMAIL_PARAM = ['login', 'password_reset', 'signup'] + MODAL_PAGES = ['password_reset', 'signup'] def show return redirect_to(path '/') if current_user && (params[:id] == 'login' || params[:id] == 'signup') @@ -69,6 +70,11 @@ class StaticController < ApplicationController return end + if MODAL_PAGES.include?(@page) + render html: nil, layout: true + return + end + raise Discourse::NotFound end diff --git a/app/views/static/password_reset.html.erb b/app/views/static/password_reset.html.erb deleted file mode 100644 index 0100cc870b2..00000000000 --- a/app/views/static/password_reset.html.erb +++ /dev/null @@ -1 +0,0 @@ - diff --git a/app/views/static/signup.html.erb b/app/views/static/signup.html.erb deleted file mode 100644 index 1c5ecea63c2..00000000000 --- a/app/views/static/signup.html.erb +++ /dev/null @@ -1 +0,0 @@ - diff --git a/spec/requests/static_controller_spec.rb b/spec/requests/static_controller_spec.rb index feec6a38e7b..f6ec174a24d 100644 --- a/spec/requests/static_controller_spec.rb +++ b/spec/requests/static_controller_spec.rb @@ -103,16 +103,6 @@ describe StaticController do expect(response.body).to include(I18n.t('js.faq')) expect(response.body).to include("FAQ - Discourse") end - - it "should return the right response for /signup" do - get "/signup" - expect(response.status).to eq(200) - end - - it "should return the right response for /password-reset" do - get "/password-reset" - expect(response.status).to eq(200) - end end [ @@ -149,6 +139,18 @@ describe StaticController do get "/static/does-not-exist" expect(response.status).to eq(404) end + + context "modal pages" do + it "should return the right response for /signup" do + get "/signup" + expect(response.status).to eq(200) + end + + it "should return the right response for /password-reset" do + get "/password-reset" + expect(response.status).to eq(200) + end + end end it 'should redirect to / when logged in and path is /login' do