PhoenixKitWeb.Live.Components.UserSettings (phoenix_kit v1.7.207)

Copy Markdown View Source

Reusable LiveComponent for user settings management.

Provides profile, email, password, and OAuth settings in a self-contained component that can be embedded in any LiveView.

Usage

<.live_component
  module={PhoenixKitWeb.Live.Components.UserSettings}
  id="user-settings"
  user={@current_user}
/>

Required assigns

  • user — the current user struct
  • id — unique component ID

Optional assigns

  • sections — list of sections to display: :identity, :custom_fields, :email, :password, :oauth, :notifications, :sessions (default: all). :profile is accepted as a legacy alias that expands to [:identity, :custom_fields]
  • email_confirm_url_fn(token -> url) for email confirmation links (default: &Routes.url("/dashboard/settings/confirm-email/#{&1}"))
  • return_to — where OAuth redirect returns to (default: "/dashboard/settings")
  • current_session_token — raw session token of the acting browser, used by the :sessions section to mark the current device and to keep it signed in on "sign out other sessions". Without it, no session is flagged current and "sign out others" revokes every session.

Parent notifications

Sends {:phoenix_kit_user_updated, updated_user} to the parent LiveView when user data changes (profile, avatar, email, password).