mirror of
https://github.com/ash-project/ash_hq.git
synced 2024-09-20 05:13:23 +12:00
025b56d1a4
improvement: fix lint/security issues improvement: add CSP improvement: remove currently unnecessary/old code
17 lines
400 B
Elixir
17 lines
400 B
Elixir
defmodule AshHqWeb.LiveUserAuth do
|
|
@moduledoc """
|
|
Helpers for authenticating users in liveviews
|
|
"""
|
|
|
|
@doc """
|
|
Sets the current user on each mount of a liveview
|
|
"""
|
|
def on_mount(:live_user, _params, session, socket) do
|
|
{:cont,
|
|
Phoenix.LiveView.assign(
|
|
socket,
|
|
:current_user,
|
|
AshHqWeb.UserAuth.user_for_session_token(session["user_token"])
|
|
)}
|
|
end
|
|
end
|