Current section

Files

Jump to
auth_n lib html auth_n_helpers.ex
Raw

lib/html/auth_n_helpers.ex

defmodule AuthN.HTML.AuthNHelpers do
def authenticated?(conn) do
!!AuthN.SessionStorage.get_user_id(conn)
end
def current_user(conn) do
with true <- authenticated?(conn),
%{current_user: current_user} = conn.assigns do
current_user
else
_ -> nil
end
end
end