View Source PlausibleWeb.UserAuth (Plausible v0.0.1)
Functions for user session management.
Summary
Functions
Sets the logged_in
cookie share with the static site for determining
whether client is authenticated.
Functions
@spec get_user_session(Plug.Conn.t() | map()) :: {:ok, Plausible.Auth.UserSession.t()} | {:error, :no_valid_token | :session_not_found}
@spec log_in_user(Plug.Conn.t(), Plausible.Auth.User.t(), String.t() | nil) :: Plug.Conn.t()
@spec log_out_user(Plug.Conn.t()) :: Plug.Conn.t()
@spec revoke_all_user_sessions(Plausible.Auth.User.t(), Keyword.t()) :: :ok
@spec revoke_user_session(Plausible.Auth.User.t(), pos_integer()) :: :ok
@spec set_logged_in_cookie(Plug.Conn.t()) :: Plug.Conn.t()
Sets the logged_in
cookie share with the static site for determining
whether client is authenticated.
As it's a separate cookie, there's a chance it might fall out of sync with session cookie state due to manual deletion or premature expiration.
Link to this function
touch_user_session(user_session, now \\ NaiveDateTime.utc_now(:second))
View Source@spec touch_user_session(Plausible.Auth.UserSession.t(), NaiveDateTime.t()) :: Plausible.Auth.UserSession.t()