Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Knuchel committed Nov 9, 2023
1 parent 2f671de commit d807963
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions backend/lib/azimutt_web/controllers/user_auth.ex
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ defmodule AzimuttWeb.UserAuth do

!user.confirmed_at && Azimutt.config(:require_email_confirmation) && !Azimutt.config(:skip_email_confirmation) &&
!is_email_confirm_path(conn, path) && Date.compare(user.created_at, ~D[2023-04-19]) == :gt ->
# TODO: remove the date check when we are sure all users have confirmed their email
conn |> redirect(to: Routes.user_confirmation_path(conn, :new)) |> halt()

user.onboarding && !Azimutt.config(:skip_onboarding_funnel) &&
Expand All @@ -192,8 +193,11 @@ defmodule AzimuttWeb.UserAuth do
end
end

defp is_email_confirm_path(conn, path), do: path |> String.starts_with?(Routes.user_confirmation_path(conn, :new))
defp is_onboarding_path(conn, path), do: path |> String.starts_with?(Routes.user_onboarding_path(conn, :index))
defp is_email_confirm_path(conn, path),
do: path |> String.starts_with?(Azimutt.config(:path) <> Routes.user_confirmation_path(conn, :new))

defp is_onboarding_path(conn, path),
do: path |> String.starts_with?(Azimutt.config(:path) <> Routes.user_onboarding_path(conn, :index))

def require_authed_user_api(conn, _opts) do
if conn.assigns[:current_user] do
Expand Down
1 change: 1 addition & 0 deletions backend/lib/azimutt_web/endpoint.ex
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ defmodule AzimuttWeb.Endpoint do
gzip: false,
only:
~w(assets blog gallery elm fonts images android-chrome-192x192.png android-chrome-512x512.png apple-touch-icon.png browserconfig.xml favicon.ico favicon-16x16.png favicon-32x32.png mstile-150x150.png robots.txt safari-pinned-tab.svg screenshot.png screenshot-complex.png service-worker.js site.webmanifest)
|> Enum.map(fn p -> if(path == "", do: p, else: "#{path}/#{p}") end)

plug Plug.Static, at: "#{path}/uploads", from: Path.expand('./uploads'), gzip: false

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= if Azimutt.config(:posthog) && Azimutt.config(:posthog_key) && Azimutt.config(:posthog_host) do %>
<script>
!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags group".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);
!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags getFeatureFlag getFeatureFlagPayload reloadFeatureFlags group updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures getActiveMatchingSurveys getSurveys".split(" "),n=0;n<o.length;n++)g(u,o[n]);e._i.push([i,s,a])},e.__SV=1)}(document,window.posthog||[]);
posthog.init('<%= Azimutt.config(:posthog_key) %>',{
api_host:'<%= Azimutt.config(:posthog_host) %>',
session_recording: {maskAllInputs: false}
Expand Down

0 comments on commit d807963

Please sign in to comment.