<%= form_with model: @user, url: profile_path, method: :patch, class: "card card-body space-y-4 max-w-md" do |f| %>
<%= f.errors_summary %>
<%= f.field :name %>
<%= f.field :email_address, as: :email, label: "Email" %>
<%= f.field :reminder_emails, as: :checkbox, label: "Weekly maintenance reminders",
hint: "A Monday email about overdue and upcoming inspections, ADs, parts and documents on aircraft you own, and certificates of yours about to expire. Only sent when something needs attention#{' (once email is set up)' unless MailSettings.configured?}." %>
<%= f.field :password, as: :password, label: "New password", hint: "Leave blank to keep your current password. At least #{User::PASSWORD_MIN} characters; not one known from a data breach.", autocomplete: "new-password" %>
<%= f.field :password_confirmation, as: :password, label: "Confirm new password", autocomplete: "new-password" %>
Needed to change your email or password.<%= " Signed up with #{Sso.label} and never set one? Use “Forgot password?” on the sign-in page." if Sso.enabled? && @user.sso_uid? %>
<%= f.submit "Save" %>
<% end %>
<% if Sso.enabled? %>
Single sign-on
<% if @user.sso_uid? %>
Your account is linked to <%= Sso.label %>; you can sign in with it.
<% if Sso.password_login? %>
<%= button_to "Unlink #{Sso.label}", sso_link_path, method: :delete, class: "btn-secondary btn-sm",
form: { data: { turbo_confirm: "Unlink #{Sso.label}? You'll sign in with your email and password." } } %>
<% end %>
<% else %>
Link your <%= Sso.label %> account to sign in with it.
On since <%= fmt_date(@user.otp_enabled_at.to_date) %>: signing in with your password or an emailed link also asks for a code from your authenticator app. <%= @user.recovery_codes_left %> recovery codes left.
Add a code from an authenticator app on your phone to password and emailed-link sign-in, so a stolen password alone can't get in.<%= " (Signing in with #{Sso.label} uses its own second factor.)" if Sso.enabled? %>
What's coming due on your aircraft (inspections, ADs, part replacements and limits, expiring documents) in your calendar app. Items due by hours get a date projected from the past year's flying; it updates on its own.
<% if @user.calendar_token.present? %>
<% feed = "#{Sso.app_url}#{calendar_feed_path(@user.calendar_token)}" %>
<%= link_to "Subscribe", feed.sub(%r{\Ahttps?://}, "webcal://"), class: "btn-secondary btn-sm" %>
<%= button_to "Make a new link", calendar_token_path, class: "btn-secondary btn-sm",
form: { data: { turbo_confirm: "Replace the calendar link? Calendars using the old one stop updating." } } %>
Anyone with this link can see the due list, so keep it private. In Google Calendar: Other calendars → From URL. On an iPhone: tap Subscribe.
You're signed in on <%= pluralize(others, "other device or browser", plural: "other devices or browsers") %>.
Sessions unused for <%= Authentication::SESSION_IDLE_TIMEOUT.inspect %> sign out on their own.