defmodule PhoenixKitWeb.TestRequireAuthLive do @moduledoc """ Test component for phoenix_kit_mount_current_scope authentication level. This page shows current scope information without requiring authentication. """ use PhoenixKitWeb, :live_view alias PhoenixKit.Users.Auth.Scope def render(assigns) do ~H"""
This page uses PhoenixKit phoenix_kit_mount_current_scope.
Modern scope system that mounts current scope without requiring authentication.
Scope Status: authenticated? = {Scope.authenticated?(@phoenix_kit_current_scope)}
User Status: anonymous? = {Scope.anonymous?(@phoenix_kit_current_scope)}
<%= if Scope.authenticated?(@phoenix_kit_current_scope) do %>Email: {Scope.user_email(@phoenix_kit_current_scope)}
ID: {Scope.user_id(@phoenix_kit_current_scope)}
<%= if Scope.user(@phoenix_kit_current_scope).confirmed_at do %>Status: Confirmed at {Scope.user(@phoenix_kit_current_scope).confirmed_at}
<% else %>Status: Not confirmed
<% end %> <% else %>Page is accessible but scope is anonymous
Both @phoenix_kit_current_scope and @phoenix_kit_current_user available
<% end %>