forked from fixin.me/fixin.me
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>
This commit is contained in:
@@ -55,11 +55,8 @@ module FixinMe
|
||||
# Sender address of account registration-related messages
|
||||
Devise.mailer_sender = 'noreply@localhost'
|
||||
|
||||
# When set to true, new user registrations are automatically confirmed
|
||||
# without requiring email verification, so accounts become active
|
||||
# immediately upon sign-up. Intended for installations where outgoing
|
||||
# email is not configured, or for development / testing environments.
|
||||
# Defaults to false (email confirmation is required).
|
||||
# config.skip_email_confirmation = true
|
||||
# Whether to skip e-mail confirmation for new registrations is configured
|
||||
# through the web setup wizard and stored in the database (Setting model),
|
||||
# so it does not need to be set here.
|
||||
end
|
||||
end
|
||||
|
||||
@@ -163,6 +163,23 @@ en:
|
||||
<br><em>leave blank to keep unchanged</em>
|
||||
%{password_length_hint_html}
|
||||
actions: Actions
|
||||
setup:
|
||||
new:
|
||||
admin_account: Admin account
|
||||
admin_email: 'E-mail:'
|
||||
admin_password: 'Password:'
|
||||
admin_password_confirmation: 'Retype password:'
|
||||
options: Options
|
||||
skip_email_confirmation: Skip e-mail confirmation for new registrations
|
||||
seed_units: Seed built-in default units
|
||||
submit: Set up
|
||||
create:
|
||||
email_blank: E-mail cannot be blank.
|
||||
password_blank: Password cannot be blank.
|
||||
password_mismatch: Passwords do not match.
|
||||
success: >
|
||||
Installation complete. You can now sign in with the admin account you
|
||||
just created.
|
||||
add: Add
|
||||
apply: Apply
|
||||
back: Back
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
Rails.application.routes.draw do
|
||||
# Web-based installation wizard — only reachable when no admin exists yet.
|
||||
resource :setup, only: [:new, :create], controller: :setup
|
||||
|
||||
resources :measurements
|
||||
|
||||
resources :readouts, only: [:new] do
|
||||
|
||||
Reference in New Issue
Block a user