<%= label_tag "user[current_password]", "Current password", class: "label" %>
<%= password_field_tag "user[current_password]", nil, id: "user_current_password", class: "input", autocomplete: "current-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.
<%= button_to "Link #{Sso.label}", "/auth/#{Sso::PROVIDER}", class: "btn-secondary btn-sm", data: { turbo: false } %>
<% end %>
<% end %>
Certificates
Your FAA certificates, for signing logbook entries: “Sign as” fills in your name, the kind of certificate and its number.
<% if @user.certificates.any? %>
<% @user.certificates.each do |c| %>
-
<%= c.kind_label %> · <%= c.number %>
<% if c.expires_on %><%= c.expired? ? "Expired" : "Expires" %> <%= c.expires_on %><% end %>
<%= button_to "Remove", certificate_path(c), method: :delete, class: "btn-secondary btn-sm", form: { data: { turbo_confirm: "Remove your #{c.kind_label} certificate?" } } %>
<% end %>
<% end %>
<%= form_with model: UserCertificate.new, url: certificates_path, class: "mt-3 grid gap-2 sm:grid-cols-[1fr_8rem]" do |f| %>
<%= f.select :kind, UserCertificate::KINDS.invert, {}, class: "input", "aria-label": "Kind of certificate" %>
<%= f.text_field :number, class: "input", placeholder: "Number", required: true, maxlength: 40, "aria-label": "Certificate number" %>
<%= f.label :expires_on, "Expires (optional)", class: "label" %><%= f.date_field :expires_on, class: "input" %>
<%= f.submit "Add certificate", class: "btn-secondary" %>
An Inspection Authorization expires on March 31 of each odd-numbered year unless renewed; you'll be reminded 60 days ahead in the weekly email.
<% end %>
Sessions
<% others = @user.sessions.where.not(id: Current.session.id).count %>
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.
<% if others.positive? %>
<%= button_to "Sign out everywhere else", other_sessions_path, method: :delete, class: "btn-secondary btn-sm" %>
<% end %>
Integrations
<%= link_to "AirTrail sync", air_trail_connection_path, class: "link" %>:
<%= current_user.air_trail_connection&.enabled? ? "on" : "off" %>. Push the flights you log to your AirTrail flight map automatically.