defmodule PhoenixKitWeb.TestEnsureAuthLive do @moduledoc """ Test component for phoenix_kit_ensure_authenticated authentication level. This page requires authentication and redirects to login if not authenticated. """ use PhoenixKitWeb, :live_view alias PhoenixKit.Users.Auth.Scope def render(assigns) do ~H"""

phoenix_kit_ensure_authenticated

This page uses PhoenixKit phoenix_kit_ensure_authenticated. User must be authenticated to access this page.

User is authenticated!

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 %>
PhoenixKit Ensure Auth: REQUIRES LOGIN
""" end def mount(_params, _session, socket) do {:ok, socket} end end