berrypod/lib/simpleshop_theme_web/live/auth/settings.ex
jamey 4514608c07 consolidate settings into single admin page
Merge shop status, payments, products (Printify), account (email/password),
and advanced (dashboard/error tracker links) into /admin/settings. Simplify
Auth.Settings to a redirector for /users/settings and confirm-email tokens.
Remove Providers from sidebar nav. Update all redirects and tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 09:04:51 +00:00

31 lines
848 B
Elixir

defmodule SimpleshopThemeWeb.Auth.Settings do
use SimpleshopThemeWeb, :live_view
alias SimpleshopTheme.Accounts
# Confirm-email token: process it and redirect to admin settings
@impl true
def mount(%{"token" => token}, _session, socket) do
socket =
case Accounts.update_user_email(socket.assigns.current_scope.user, token) do
{:ok, _user} ->
put_flash(socket, :info, "Email changed successfully.")
{:error, _} ->
put_flash(socket, :error, "Email change link is invalid or it has expired.")
end
{:ok, redirect(socket, to: ~p"/admin/settings")}
end
# Main mount: just redirect — account settings live in admin now
def mount(_params, _session, socket) do
{:ok, redirect(socket, to: ~p"/admin/settings")}
end
@impl true
def render(assigns) do
~H""
end
end