Skip to content
Snippets Groups Projects
Commit dc8d2049 authored by Uku Taht's avatar Uku Taht
Browse files

Show locked message in shared link

parent 383bba94
Branches
No related tags found
No related merge requests found
......@@ -162,6 +162,8 @@ defmodule PlausibleWeb.StatsController do
end
defp render_shared_link(conn, shared_link) do
cond do
!shared_link.site.locked ->
conn
|> assign(:skip_plausible_tracking, true)
|> put_resp_header("x-robots-tag", "noindex")
......@@ -178,6 +180,14 @@ defmodule PlausibleWeb.StatsController do
background: conn.params["background"],
theme: conn.params["theme"]
)
shared_link.site.locked ->
owner = Plausible.Sites.owner_for(shared_link.site)
conn
|> assign(:skip_plausible_tracking, true)
|> render("site_locked.html", owner: owner, site: shared_link.site)
end
end
defp remove_email_report_banner(conn, site) do
......
......@@ -38,10 +38,12 @@
This site is currently locked and cannot be accessed. You can check back later or contact the site owner to unlock it.
</p>
</div>
<%= if @conn.assigns[:current_user] do %>
<div class="mt-6 w-full text-center">
<%= link("Back to my sites", to: "/sites", class: "inline-flex items-center px-4 py-2 border border-transparent shadow-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:text-sm") %>
</div>
<% end %>
<% end %>
</div>
</div>
</div>
......@@ -20,12 +20,12 @@
<div class="my-44">
<div class="block pulsating-circle"></div>
<p class="text-gray-600 dark:text-gray-400 text-xs absolute left-0 bottom-0 mb-6 w-full text-center leading-normal">
Need to see the snippet again? <%= link("Click here", to: "/#{URI.encode_www_form(@site.domain)}/snippet", class: "text-indigo-600 text-underline")%><br />
Not working? <%= link("Troubleshoot the integration", to: "https://plausible.io/docs/troubleshoot-integration#keep-seeing-a-blinking-green-dot", class: "text-indigo-600 text-underline", rel: "noreferrer") %> with our guide
Need to see the snippet again? <%= link("Click here", to: "/#{URI.encode_www_form(@site.domain)}/snippet", class: "text-indigo-600 dark:text-indigo-500 text-underline")%><br />
Not working? <%= link("Troubleshoot the integration", to: "https://plausible.io/docs/troubleshoot-integration#keep-seeing-a-blinking-green-dot", class: "text-indigo-600 dark:text-indigo-500 text-underline", rel: "noreferrer") %> with our guide
<%= if Application.get_env(:plausible, :is_selfhost) do %>
first<br /> Still not working? Ask on our <%= link("community-supported forum", to: "https://github.com/plausible/analytics/discussions", class: "text-indigo-600 text-underline" ) %>
first<br /> Still not working? Ask on our <%= link("community-supported forum", to: "https://github.com/plausible/analytics/discussions", class: "text-indigo-600 dark:text-indigo-500 text-underline" ) %>
<% else %>
first<br /> Still not working? <%= link("Contact us", to: "https://plausible.io/contact", class: "text-indigo-600 text-underline" ) %> and we will help you with your setup
first<br /> Still not working? <%= link("Contact us", to: "https://plausible.io/contact", class: "text-indigo-600 dark:text-indigo-500 text-underline" ) %> and we will help you with your setup
<% end %>
</p>
</div>
......
......@@ -193,6 +193,16 @@ defmodule PlausibleWeb.StatsControllerTest do
conn = get(conn, "/share/test-site.com/?auth=#{link.slug}")
assert Plug.Conn.get_resp_header(conn, "x-frame-options") == []
end
test "shows locked page if page is locked", %{conn: conn} do
site = insert(:site, domain: "test-site.com", locked: true)
link = insert(:shared_link, site: site)
conn = get(conn, "/share/test-site.com/?auth=#{link.slug}")
assert html_response(conn, 200) =~ "Site locked"
refute String.contains?(html_response(conn, 200), "Back to my sites")
end
end
describe "POST /share/:slug/authenticate" do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment