Logo
Explore Help
Sign In
jamey/berrypod
1
0
Fork 0
You've already forked berrypod
Code Issues Pull Requests Actions Packages Projects 1 Releases Wiki Activity
Files
4aa7dece0c79905effe512a85c51987b0b0acbad
berrypod/lib/berrypod_web/setup_hook.ex

19 lines
498 B
Elixir
Raw Normal View History

improve setup UX: password field, setup hook, checklist banners, theme tweaks - add password field and required shop name to setup wizard - extract SetupHook for DRY redirect to /setup when no admin exists - add ?from=checklist param to checklist hrefs with contextual banner on email settings and theme pages for easy return to dashboard - remove email warning banner from admin layout (checklist covers it) - make email a required checklist item (no longer optional) - add DevReset module for wiping dev data without restart - rename "Theme Studio" to "Theme", drop subtitle - lower theme editor side-by-side breakpoint from 64em to 48em - clean up login/registration pages (remove dead registration_open code) - fix settings.put_secret to invalidate cache after write Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 17:41:08 +00:00
defmodule BerrypodWeb.SetupHook do
@moduledoc """
Redirects to /setup when no admin account exists (fresh install).
Add `{BerrypodWeb.SetupHook, :require_admin}` to any live_session
that shouldn't be accessible before setup is complete.
"""
import Phoenix.LiveView, only: [redirect: 2]
def on_mount(:require_admin, _params, _session, socket) do
if Berrypod.Accounts.has_admin?() do
{:cont, socket}
else
{:halt, redirect(socket, to: "/setup")}
end
end
end
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.25.5 Page: 51ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API