Files
simple-aircraft-manager-rails/test/integration/setup_test.rb
T
rickyandClaude Opus 5.5 14316bb60f Sign-in hardening: lockout, stronger passwords, authenticator codes
- 10 failed sign-ins in a row (password, authenticator code, or password
  at signing) lock an account for 15 minutes from any address; the user
  is emailed; admins can unlock. Same message as a wrong password.
- Passwords: at least 12 characters (max 72), refused if found in Have I
  Been Pwned (k-anonymity range API; fails open; PWNED_PASSWORDS_CHECK=false)
- Optional TOTP (authenticator app) with 10 recovery codes for password
  and emailed-link sign-in, and at signing (auth method password_totp);
  codes accepted once; admins can reset; SSO sign-in unaffected
- Demo/test passwords updated; guide, README and procedures document

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 15:17:56 -05:00

23 lines
796 B
Ruby

require "test_helper"
class SetupTest < ActionDispatch::IntegrationTest
test "first run creates admin, then setup is closed" do
get root_path
assert_redirected_to new_setup_path
post setup_path, params: { user: { name: "Ricky", email_address: "a@b.com", password: "test-password-123", password_confirmation: "test-password-123" } }
assert_redirected_to root_path
assert User.last.admin?
get new_setup_path
assert_redirected_to root_path
end
test "create aircraft makes creator the owner" do
user = create_user
sign_in user
post aircraft_index_path, params: { aircraft: { tail_number: "N1", tach_time: 50 } }
a = Aircraft.find_by!(tail_number: "N1")
assert_redirected_to aircraft_path(a)
assert_equal "owner", user.role_for(a)
end
end