13 Commits

Author SHA1 Message Date
7904ff3ef9 Add web-based installation wizard
Replace the CLI-only setup (db:seed + manual application.rb edits)
with a web wizard shown automatically on first visit when no admin
account exists yet.

SetupController (GET/POST /setup) collects the admin e-mail and
password, a "skip e-mail confirmation" toggle, and an option to
seed the built-in default units.  Once submitted it creates the
admin User, persists the chosen options as Setting records, and
redirects to the sign-in page.

ApplicationController gains a redirect_to_setup_if_needed
before_action that catches every request (including Devise routes)
when no admin exists, so a fresh installation always lands on the
wizard rather than an empty sign-in form.

A new Setting model provides a lightweight key-value store for
runtime options that were previously hard-coded in application.rb
(e.g. skip_email_confirmation).  RegistrationsController now reads
that flag from the database instead of from the application config.

Seeds.rb is kept for headless / automated deployments and skips
admin creation when an admin already exists (idempotent), with a
comment pointing to the web wizard as the preferred path.

Also extends the SQLite nil-limit fix (|| Float::INFINITY) to the
Quantity model, which suffered the same ArgumentError as Unit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 17:19:24 +00:00
9ad922e3a1 Add skip_email_confirmation option; fix SQLite length validation
Introduce config.skip_email_confirmation in application.rb.dist.
When set to true, new registrations are automatically confirmed
without requiring email verification — useful for installations
where outgoing email is not configured or for development/testing.
Implemented by calling skip_confirmation! in build_resource before
the record is saved, so no confirmation email is ever sent.

Also fix ArgumentError raised in length validations when
type_for_attribute(:column).limit returns nil, which happens with
SQLite for string columns that have no explicit limit in the
migration. Guard with || Float::INFINITY so the validation is
effectively skipped when the database imposes no limit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 15:57:50 +00:00
magicfixin
5ffc6974f0 Improve installation process 2025-07-23 23:42:41 +02:00
769e4af603 Bring per-installation setting to application.rb 2024-06-04 00:47:50 +02:00
e905910719 Import previously missed settings to *.dist 2024-06-04 00:45:33 +02:00
9d97eb3f6f Add user status update 2023-05-17 23:40:09 +02:00
634ba7e901 Add access control and :forbidden error handling 2023-04-24 23:08:55 +02:00
2d95b11a34 Test registration e-mail 2023-04-19 00:31:52 +02:00
6d71d38680 Add registration redirection and mail confirmation sending 2023-04-15 23:52:02 +02:00
e29c060a39 Add user statuses and seed admin user 2023-04-01 02:29:59 +02:00
24f85d1d28 Add 'hosts' application setting 2023-03-14 23:39:31 +01:00
3ea1b29cb4 Set application name related values to FixinMe 2023-03-06 15:05:56 +01:00
2ecf06b751 rails generate devise:install 2023-03-06 01:48:07 +01:00