Revert baypass_static_pages config

pull/14087/head
rubenmoya 6 years ago
parent 302740c779
commit 1fbaddc9fd

@ -28,7 +28,7 @@ class Admin::UsersController < Admin::AdminController
PASSWORD_DOES_NOT_MATCH_MESSAGE = 'Password does not match'.freeze
def profile
if !Cartodb.config[:bypass_static_pages].present?
if current_user.has_feature_flag?('dashboard_migration')
return render(file: "public/static/profile/index.html", layout: false)
end
@ -40,7 +40,7 @@ class Admin::UsersController < Admin::AdminController
end
def account
if !Cartodb.config[:bypass_static_pages].present?
if current_user.has_feature_flag?('dashboard_migration')
return render(file: "public/static/account/index.html", layout: false)
end

@ -58,7 +58,7 @@ class Admin::VisualizationsController < Admin::AdminController
skip_before_filter :verify_authenticity_token, only: [:show_protected_public_map, :show_protected_embed_map]
def index
if Cartodb.config[:bypass_static_pages].blank?
if current_user.has_feature_flag?('dashboard_migration')
return render(file: "public/static/dashboard/index.html", layout: false)
end

@ -732,7 +732,6 @@ defaults: &defaults
isolines: false
routing: false
data_observatory: false
# bypass_static_pages: true
development:

@ -206,29 +206,27 @@ describe Admin::PagesController do
end
it 'extracts username from redirection for dashboard with subdomainless' do
Cartodb.with_config(bypass_static_pages: true) do
username = 'endedwithu'
anyuser = prepare_user(username)
host! 'localhost.lan'
login_as(anyuser, scope: anyuser.username)
CartoDB.stubs(:session_domain).returns('localhost.lan')
CartoDB.stubs(:subdomainless_urls?).returns(true)
username = 'endedwithu'
anyuser = prepare_user(username)
host! 'localhost.lan'
login_as(anyuser, scope: anyuser.username)
CartoDB.stubs(:session_domain).returns('localhost.lan')
CartoDB.stubs(:subdomainless_urls?).returns(true)
get '', {}, JSON_HEADER
get '', {}, JSON_HEADER
last_response.status.should == 302
uri = URI.parse(last_response.location)
uri.host.should == 'localhost.lan'
uri.path.should == "/user/#{username}/dashboard"
last_response.status.should == 302
uri = URI.parse(last_response.location)
uri.host.should == 'localhost.lan'
uri.path.should == "/user/#{username}/dashboard"
login_as(anyuser, scope: anyuser.username)
location = last_response.location
User.any_instance.stubs(:db_size_in_bytes).returns(0)
get location
last_response.status.should == 200
login_as(anyuser, scope: anyuser.username)
location = last_response.location
User.any_instance.stubs(:db_size_in_bytes).returns(0)
get location
last_response.status.should == 200
anyuser.delete
end
anyuser.delete
end
it 'redirects to login without login' do

@ -44,12 +44,10 @@ describe Admin::TablesController do
describe 'GET /dashboard' do
it 'returns a list of tables' do
Cartodb.with_config(bypass_static_pages: true) do
login_as(@user, scope: @user.username)
login_as(@user, scope: @user.username)
get "/dashboard", {}, @headers
last_response.status.should == 200
end
get "/dashboard", {}, @headers
last_response.status.should == 200
end
end # GET /tables

@ -57,12 +57,10 @@ describe Admin::VisualizationsController do
describe 'GET /viz' do
it 'returns a list of visualizations' do
Cartodb.with_config(bypass_static_pages: true) do
login_as(@user, scope: @user.username)
login_as(@user, scope: @user.username)
get "/viz", {}, @headers
last_response.status.should == 200
end
get "/viz", {}, @headers
last_response.status.should == 200
end
it 'returns 403 if user not logged in' do
@ -634,11 +632,9 @@ describe Admin::VisualizationsController do
end
it 'invokes user metadata redis caching' do
Cartodb.with_config(bypass_static_pages: true) do
Carto::UserDbSizeCache.any_instance.expects(:update_if_old).with(@user).once
login_as(@user, scope: @user.username)
get dashboard_path, {}, @headers
end
Carto::UserDbSizeCache.any_instance.expects(:update_if_old).with(@user).once
login_as(@user, scope: @user.username)
get dashboard_path, {}, @headers
end
end

@ -47,12 +47,10 @@ describe ApplicationController do
end
it 'loads the dashboard for a known user email' do
Cartodb.with_config(bypass_static_pages: true) do
stub_load_common_data
get dashboard_url, {}, authentication_headers(@user.email)
response.status.should == 200
response.body.should_not include("Log in")
end
stub_load_common_data
get dashboard_url, {}, authentication_headers(@user.email)
response.status.should == 200
response.body.should_not include("Log in")
end
it 'does not load the dashboard for an unknown user email' do
@ -72,12 +70,10 @@ describe ApplicationController do
end
it 'loads the dashboard for a known user username' do
Cartodb.with_config(bypass_static_pages: true) do
stub_load_common_data
get dashboard_url, {}, authentication_headers(@user.username)
response.status.should == 200
response.body.should_not include("Log in")
end
stub_load_common_data
get dashboard_url, {}, authentication_headers(@user.username)
response.status.should == 200
response.body.should_not include("Log in")
end
it 'does not load the dashboard for an unknown user username' do
@ -97,12 +93,10 @@ describe ApplicationController do
end
it 'loads the dashboard for a known user id' do
Cartodb.with_config(bypass_static_pages: true) do
stub_load_common_data
get dashboard_url, {}, authentication_headers(@user.id)
response.status.should == 200
response.body.should_not include("Log in")
end
stub_load_common_data
get dashboard_url, {}, authentication_headers(@user.id)
response.status.should == 200
response.body.should_not include("Log in")
end
it 'does not load the dashboard for an unknown user id' do
@ -122,30 +116,24 @@ describe ApplicationController do
end
it 'loads the dashboard for a known user id' do
Cartodb.with_config(bypass_static_pages: true) do
stub_load_common_data
get dashboard_url, {}, authentication_headers(@user.id)
response.status.should == 200
response.body.should_not include("Log in")
end
stub_load_common_data
get dashboard_url, {}, authentication_headers(@user.id)
response.status.should == 200
response.body.should_not include("Log in")
end
it 'loads the dashboard for a known user username' do
Cartodb.with_config(bypass_static_pages: true) do
stub_load_common_data
get dashboard_url, {}, authentication_headers(@user.username)
response.status.should == 200
response.body.should_not include("Log in")
end
stub_load_common_data
get dashboard_url, {}, authentication_headers(@user.username)
response.status.should == 200
response.body.should_not include("Log in")
end
it 'loads the dashboard for a known user email' do
Cartodb.with_config(bypass_static_pages: true) do
stub_load_common_data
get dashboard_url, {}, authentication_headers(@user.email)
response.status.should == 200
response.body.should_not include("Log in")
end
stub_load_common_data
get dashboard_url, {}, authentication_headers(@user.email)
response.status.should == 200
response.body.should_not include("Log in")
end
it 'does not load the dashboard for an unknown user id' do

@ -313,18 +313,16 @@ describe SessionsController do
end
it "authenticates users with casing differences in email" do
Cartodb.with_config(bypass_static_pages: true) do
Carto::SamlService.any_instance.stubs(:enabled?).returns(true)
Carto::SamlService.any_instance.stubs(:get_user_email).returns(@user.email.upcase)
Carto::SamlService.any_instance.stubs(:enabled?).returns(true)
Carto::SamlService.any_instance.stubs(:get_user_email).returns(@user.email.upcase)
post create_session_url(user_domain: user_domain, SAMLResponse: 'xx')
post create_session_url(user_domain: user_domain, SAMLResponse: 'xx')
response.status.should eq 302
response.status.should eq 302
# Double check authentication is correct
get response.redirect_url
response.status.should eq 200
end
# Double check authentication is correct
get response.redirect_url
response.status.should eq 200
end
describe 'SAML logout' do

@ -39,20 +39,18 @@ feature "Sessions" do
end
scenario "Login in the application" do
Cartodb.with_config(bypass_static_pages: true) do
visit login_path
fill_in 'email', :with => @user.email
fill_in 'password', :with => 'blablapassword'
click_link_or_button 'Log in'
page.should have_css(".Sessions-fieldError.js-Sessions-fieldError")
page.should have_css("[@data-content='Your account or your password is not ok']")
fill_in 'email', :with => @user.email
fill_in 'password', :with => @user.email.split('@').first
click_link_or_button 'Log in'
page.should be_dashboard
end
visit login_path
fill_in 'email', :with => @user.email
fill_in 'password', :with => 'blablapassword'
click_link_or_button 'Log in'
page.should have_css(".Sessions-fieldError.js-Sessions-fieldError")
page.should have_css("[@data-content='Your account or your password is not ok']")
fill_in 'email', :with => @user.email
fill_in 'password', :with => @user.email.split('@').first
click_link_or_button 'Log in'
page.should be_dashboard
end
scenario "Get the session information via OAuth" do
@ -115,11 +113,9 @@ feature "Sessions" do
include_context 'organization with users helper'
it 'allows login to organization users' do
Cartodb.with_config(bypass_static_pages: true) do
visit org_login_url(@org_user_1.organization)
send_login_form(@org_user_1)
page.should be_dashboard
end
visit org_login_url(@org_user_1.organization)
send_login_form(@org_user_1)
page.should be_dashboard
end
it 'does not allow user+password login to organization users if auth_username_password_enabled is false' do

@ -181,13 +181,11 @@ describe "UserState" do
Admin::UsersController.any_instance.stubs(:render)
login(@locked_user)
host! "#{@locked_user.username}.localhost.lan"
Cartodb.with_config(bypass_static_pages: true) do
@dashboard_endpoints.each do |endpoint|
get endpoint, {}, @headers
follow_redirects
request.path.should_not == '/lockout'
response.status.should == 200
end
@dashboard_endpoints.each do |endpoint|
get endpoint, {}, @headers
follow_redirects
request.path.should_not == '/lockout'
response.status.should == 200
end
@user_endpoints.each do |endpoint|
get endpoint, {}, @headers
@ -225,20 +223,18 @@ describe "UserState" do
end
end
it 'non locked user accessing a locked user resources' do
Cartodb.with_config(bypass_static_pages: true) do
login(@non_locked_user)
@user_endpoints.each do |endpoint|
host! "#{@locked_user.username}.localhost.lan"
get endpoint, {}, @headers
follow_redirects
response.status.should == 200
end
@public_user_endpoints.each do |endpoint|
host! "#{@locked_user.username}.localhost.lan"
get endpoint, {}, @headers
follow_redirects
response.status.should == 200
end
login(@non_locked_user)
@user_endpoints.each do |endpoint|
host! "#{@locked_user.username}.localhost.lan"
get endpoint, {}, @headers
follow_redirects
response.status.should == 200
end
@public_user_endpoints.each do |endpoint|
host! "#{@locked_user.username}.localhost.lan"
get endpoint, {}, @headers
follow_redirects
response.status.should == 200
end
@tables_endpoints.each do |endpoint|
host! "#{@locked_user.username}.localhost.lan"

@ -74,7 +74,7 @@ describe 'Warden' do
end
it 'allows access for non-expired session' do
Cartodb.with_config(passwords: { 'expiration_in_d' => nil }, bypass_static_pages: true) do
Cartodb.with_config(passwords: { 'expiration_in_d' => nil }) do
login
host! "#{@user.username}.localhost.lan"

Loading…
Cancel
Save