+ <%= form_with model: @user, url: profile_path, method: :patch, class: "card card-body space-y-4" do |f| %>
+
<%= t(".account") %>
+ <%= f.errors_summary %>
+ <%= f.field :name %>
+ <%= f.field :email_address, as: :email, label: t(".email") %>
+ <%= f.field :reminder_emails, as: :checkbox, label: t(".weekly_maintenance_reminders"),
+ hint: t(MailSettings.configured? ? ".a_monday_email_about_overdue" : ".reminders_once_email_set_up") %>
+
+ <%= f.label :time_zone, t(".time_zone"), class: "label" %>
+ <%= f.time_zone_select :time_zone, ActiveSupport::TimeZone.us_zones,
+ { include_blank: t(".time_zone_automatic", zone: device_time_zone_label || t(".time_zone_unknown")) },
+ class: "input" %>
+
<%= t(".time_zone_hint", now: fmt_time(Time.current)) %>
+
+ <%= f.field :password, as: :password, label: t(".new_password"), hint: t(".leave_blank_to_keep_your", min: User::PASSWORD_MIN), autocomplete: "new-password" %>
+ <%= f.field :password_confirmation, as: :password, label: t(".confirm_new_password"), autocomplete: "new-password" %>
+
+ <%= label_tag "user[current_password]", t(".current_password"), class: "label" %>
+ <%= password_field_tag "user[current_password]", nil, id: "user_current_password", class: "input", autocomplete: "current-password" %>
+
<%= t(".needed_to_change_your_email_html", sso_uid: (t(".signed_up_with_and_never", so: Sso.label) if Sso.enabled? && @user.sso_uid?)) %>
+
+ <%= f.submit t(".save") %>
<% end %>
-
-<% end %>
-
- <%= t(".two_factor_sign_in") %>
- <% if @user.otp_enabled? %>
- <%= t(".on") %> <%= t(".since_signing_in_with_your_html", to_date: (fmt_date(@user.otp_enabled_at.to_date)), recovery_codes_left: @user.recovery_codes_left) %>
- <%= form_with url: two_factor_path, class: "mt-3 flex flex-wrap items-end gap-2" do |f| %>
- <%= label_tag :code, t(".current_code_or_a_recovery"), class: "label" %><%= text_field_tag :code, nil, required: true, autocomplete: "one-time-code", class: "input w-44" %>
- <%= button_tag t(".new_recovery_codes"), type: "submit", formaction: recovery_codes_two_factor_path, class: "btn-secondary btn-sm" %>
- <%= button_tag t(".turn_off"), type: "submit", name: "_method", value: "delete", class: "btn-secondary btn-sm", data: { turbo_confirm: t(".turn_off_two_factor_sign") } %>
+ <% if Sso.enabled? %>
+
+ <%= t(".single_sign_on") %>
+ <% if @user.sso_uid? %>
+ <%= t(".your_account_is_linked_to_html", so: Sso.label) %>
+ <% if Sso.password_login? %>
+ <%= button_to t(".unlink", so: Sso.label), sso_link_path, method: :delete, class: "btn-secondary btn-sm",
+ form: { data: { turbo_confirm: t(".unlink_you_ll_sign_in", so: Sso.label) } } %>
+ <% end %>
+ <% else %>
+ <%= t(".link_your_account_to_sign_html", so: Sso.label) %>
+ <%= button_to t(".link", so: Sso.label), "/auth/#{Sso::PROVIDER}", class: "btn-secondary btn-sm", data: { turbo: false } %>
+ <% end %>
+
<% end %>
- <% else %>
- <%= t(".add_a_code_from_an_html", enabled: (t(".signing_in_with_uses_its", so: Sso.label) if Sso.enabled?)) %>
- <%= link_to t(".set_up"), new_two_factor_path, class: "btn-secondary btn-sm" %>
- <% end %>
-
-
- <%= t(".calendar_feed") %>
- <%= t(".what_s_coming_due_on") %>
- <% if @user.calendar_token.present? %>
- <% feed = "#{Sso.app_url}#{calendar_feed_path(@user.calendar_token)}" %>
- ">
-
- <%= link_to t(".subscribe"), feed.sub(%r{\Ahttps?://}, "webcal://"), class: "btn-secondary btn-sm" %>
- <%= button_to t(".make_a_new_link"), calendar_token_path, class: "btn-secondary btn-sm",
- form: { data: { turbo_confirm: t(".replace_the_calendar_link_calendars") } } %>
-
- <%= t(".anyone_with_this_link_can") %>
- <% else %>
- <%= button_to t(".create_calendar_link"), calendar_token_path, class: "btn-secondary btn-sm" %>
- <% end %>
-
-
-
- <%= t(".certificates") %>
- <%= t(".your_faa_certificates_for_signing") %>
- <% if @user.certificates.any? %>
-
- <% @user.certificates.each do |c| %>
-
- <%= c.kind_label %> · <%= c.number %>
- <% if c.expires_on %><%= c.expired? ? t(".expired") : t(".expires") %> <%= fmt_date(c.expires_on) %> <% end %>
- <%= button_to t(".remove"), certificate_path(c), method: :delete, class: "btn-secondary btn-sm", form: { data: { turbo_confirm: t(".remove_your_certificate", kind_label: c.kind_label) } } %>
-
+
+ <%= t(".two_factor_sign_in") %>
+ <% if @user.otp_enabled? %>
+ <%= t(".on") %> <%= t(".since_signing_in_with_your_html", to_date: (fmt_date(@user.otp_enabled_at.to_date)), recovery_codes_left: @user.recovery_codes_left) %>
+ <%= form_with url: two_factor_path, class: "mt-3 flex flex-wrap items-end gap-2" do |f| %>
+ <%= label_tag :code, t(".current_code_or_a_recovery"), class: "label" %><%= text_field_tag :code, nil, required: true, autocomplete: "one-time-code", class: "input w-44" %>
+ <%= button_tag t(".new_recovery_codes"), type: "submit", formaction: recovery_codes_two_factor_path, class: "btn-secondary btn-sm" %>
+ <%= button_tag t(".turn_off"), type: "submit", name: "_method", value: "delete", class: "btn-secondary btn-sm", data: { turbo_confirm: t(".turn_off_two_factor_sign") } %>
+ <% end %>
+ <% else %>
+ <%= t(".add_a_code_from_an_html", enabled: (t(".signing_in_with_uses_its", so: Sso.label) if Sso.enabled?)) %>
+ <%= link_to t(".set_up"), new_two_factor_path, class: "btn-secondary btn-sm" %>
<% 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": t(".kind_of_certificate") %>
- <%= f.text_field :number, class: "input", placeholder: t(".number"), required: true, maxlength: 40, "aria-label": t(".certificate_number") %>
-
-
<%= f.label :expires_on, t(".expires_optional"), class: "label" %><%= f.date_field :expires_on, class: "input" %>
- <%= f.submit t(".add_certificate"), class: "btn-secondary" %>
-
- <%= t(".an_inspection_authorization_expires_on") %>
- <% end %>
-
+
-
- <%= t(".this_device") %>
-
-
<%= t(".install_heading") %>
-
<%= t(".install_why") %>
-
<%= t(".installed") %>
-
<%= t(".install") %>
-
<%= t(".install_ios_html") %>
-
<%= t(".install_other") %>
+
+ <%= t(".sessions") %>
+ <% others = @user.sessions.where.not(id: Current.session.id).count %>
+
+ <%= t(".you_re_signed_in_on", count: others) %>
+ <%= t(".sessions_unused_for_sign_out_html", days: (Authentication::SESSION_IDLE_TIMEOUT.in_days.to_i)) %>
+
+ <% if others.positive? %>
+ <%= button_to t(".sign_out_everywhere_else"), other_sessions_path, method: :delete, class: "btn-secondary btn-sm" %>
+ <% end %>
+
-
-
<%= t(".notifications_heading") %>
-
<%= t(".notifications_what") %>
-
-
- <%= t(".notifications_on") %>
- <%= t(".notifications_off") %>
- <%= t(".notifications_test") %>
-
+
+
+
+ <%= t(".calendar_feed") %>
+ <%= t(".what_s_coming_due_on") %>
+ <% if @user.calendar_token.present? %>
+ <% feed = "#{Sso.app_url}#{calendar_feed_path(@user.calendar_token)}" %>
+ ">
+
+ <%= link_to t(".subscribe"), feed.sub(%r{\Ahttps?://}, "webcal://"), class: "btn-secondary btn-sm" %>
+ <%= button_to t(".make_a_new_link"), calendar_token_path, class: "btn-secondary btn-sm",
+ form: { data: { turbo_confirm: t(".replace_the_calendar_link_calendars") } } %>
+
+ <%= t(".anyone_with_this_link_can") %>
+ <% else %>
+ <%= button_to t(".create_calendar_link"), calendar_token_path, class: "btn-secondary btn-sm" %>
+ <% end %>
+
+
+
+ <%= t(".certificates") %>
+ <%= t(".your_faa_certificates_for_signing") %>
+ <% if @user.certificates.any? %>
+
+ <% @user.certificates.each do |c| %>
+
+ <%= c.kind_label %> · <%= c.number %>
+ <% if c.expires_on %><%= c.expired? ? t(".expired") : t(".expires") %> <%= fmt_date(c.expires_on) %> <% end %>
+ <%= button_to t(".remove"), certificate_path(c), method: :delete, class: "btn-secondary btn-sm", form: { data: { turbo_confirm: t(".remove_your_certificate", kind_label: c.kind_label) } } %>
+
+ <% 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": t(".kind_of_certificate") %>
+ <%= f.text_field :number, class: "input", placeholder: t(".number"), required: true, maxlength: 40, "aria-label": t(".certificate_number") %>
+
+
<%= f.label :expires_on, t(".expires_optional"), class: "label" %><%= f.date_field :expires_on, class: "input" %>
+ <%= f.submit t(".add_certificate"), class: "btn-secondary" %>
+
+ <%= t(".an_inspection_authorization_expires_on") %>
+ <% end %>
+
+
+
+ <%= t(".this_device") %>
+
+
<%= t(".install_heading") %>
+
<%= t(".install_why") %>
+
<%= t(".installed") %>
+
<%= t(".install") %>
+
<%= t(".install_ios_html") %>
+
<%= t(".install_other") %>
+
+
+
<%= t(".notifications_heading") %>
+
<%= t(".notifications_what") %>
+
+
+ <%= t(".notifications_on") %>
+ <%= t(".notifications_off") %>
+ <%= t(".notifications_test") %>
+
+
+
+
+
+ <%= t(".integrations") %>
+
+ <%= link_to t(".airtrail_sync"), air_trail_connection_path, class: "link" %>:
+ <%= t(".push_the_flights_you_log_html", off: (current_user.air_trail_connection&.enabled? ? "on" : "off")) %>
+
+
-
-
-
- <%= t(".sessions") %>
- <% others = @user.sessions.where.not(id: Current.session.id).count %>
-
- <%= t(".you_re_signed_in_on", count: others) %>
- <%= t(".sessions_unused_for_sign_out_html", days: (Authentication::SESSION_IDLE_TIMEOUT.in_days.to_i)) %>
-
- <% if others.positive? %>
- <%= button_to t(".sign_out_everywhere_else"), other_sessions_path, method: :delete, class: "btn-secondary btn-sm" %>
- <% end %>
-
-
-
- <%= t(".integrations") %>
-
- <%= link_to t(".airtrail_sync"), air_trail_connection_path, class: "link" %>:
- <%= t(".push_the_flights_you_log_html", off: (current_user.air_trail_connection&.enabled? ? "on" : "off")) %>
-
-
+
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 4dfb9e9..8deaa3a 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -2943,6 +2943,7 @@ en:
profiles:
edit:
your_profile: Your Profile
+ account: Account
email: Email
weekly_maintenance_reminders: Weekly maintenance reminders
a_monday_email_about_overdue: 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.
diff --git a/test/integration/workflow_polish_test.rb b/test/integration/workflow_polish_test.rb
index c7fc60c..5404694 100644
--- a/test/integration/workflow_polish_test.rb
+++ b/test/integration/workflow_polish_test.rb
@@ -92,4 +92,13 @@ class WorkflowPolishTest < ActionDispatch::IntegrationTest
assert_select "dl > div.detail-row > dt", minimum: 6
assert_select "dl dd.col-span-3", 0
end
+
+ test "the profile is two columns on a wide screen: the account and its security, then the rest" do
+ sign_in @owner
+ get edit_profile_path
+ assert_select "div.max-w-5xl > div", 2
+ assert_select "div.max-w-5xl > div:first-child h2", text: "Account"
+ assert_select "div.max-w-5xl > div:first-child #two-factor"
+ assert_select "div.max-w-5xl > div:last-child #device"
+ end
end