|
|
|
@ -16,11 +16,25 @@ class Admin::PagesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
ssl_required :common_data, :public, :datasets
|
|
|
|
|
|
|
|
|
|
before_filter :login_required, :except => [:public, :datasets, :sitemap]
|
|
|
|
|
before_filter :login_required, :except => [:public, :datasets, :sitemap, :index]
|
|
|
|
|
before_filter :belongs_to_organization
|
|
|
|
|
skip_before_filter :browser_is_html5_compliant?, only: [:public, :datasets]
|
|
|
|
|
skip_before_filter :ensure_user_organization_valid, only: [:public]
|
|
|
|
|
|
|
|
|
|
# Just an entrypoint to dispatch to different places according to
|
|
|
|
|
def index
|
|
|
|
|
# username.cartodb.com should redirect to the user dashboard in the maps view if the user is logged in
|
|
|
|
|
if !current_user.nil? && !current_viewer.nil? && current_user.id == current_viewer.id
|
|
|
|
|
redirect_to dashboard_url
|
|
|
|
|
# username.cartodb.com should redirect to the public user dashboard in the maps view if the username is not the user's username
|
|
|
|
|
elsif !current_viewer.nil? # Asummes either current_user nil or at least different from current_viewer
|
|
|
|
|
redirect_to public_maps_home_url
|
|
|
|
|
# username.cartodb.com should redirect to the public user dashboard in the maps view if the user is not logged in
|
|
|
|
|
else
|
|
|
|
|
redirect_to public_maps_home_url
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def sitemap
|
|
|
|
|
username = CartoDB.extract_subdomain(request)
|
|
|
|
|
viewed_user = User.where(username: username.strip.downcase).first
|
|
|
|
@ -34,7 +48,7 @@ class Admin::PagesController < ApplicationController
|
|
|
|
|
# Redirect to org url if has only user
|
|
|
|
|
if viewed_user.has_organization?
|
|
|
|
|
if CartoDB.extract_real_subdomain(request) != viewed_user.organization.name
|
|
|
|
|
redirect_to CartoDB.base_url(viewed_user.organization.name) << public_sitemap_pathand and return
|
|
|
|
|
redirect_to CartoDB.base_url(viewed_user.organization.name) << public_sitemap_path and return
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|