<%= content_for :page_title, t(".page_title") %> <%= settings_section title: t(".mfa_title"), subtitle: t(".mfa_description") do %>
<%= icon "shield-check" %>
<% if Current.user.otp_required? %>

Two-factor authentication is enabled

Your account is protected with an additional layer of security.

<% else %>

Two-factor authentication is disabled

Enable 2FA to add an extra layer of security to your account.

<% end %>
<% if Current.user.otp_required? %> <%= render DS::Button.new( text: t(".disable_mfa"), variant: "secondary", href: disable_mfa_path, method: :delete, confirm: CustomConfirm.new( title: t(".disable_mfa_confirm"), body: t(".disable_mfa_confirm"), btn_text: t(".disable_mfa"), destructive: true ) ) %> <% else %> <%= render DS::Link.new( text: t(".enable_mfa"), variant: "primary", href: new_mfa_path ) %> <% end %>
<% end %> <% if @oidc_identities.any? || AuthConfig.sso_providers.any? %> <%= settings_section title: t(".sso_title"), subtitle: t(".sso_subtitle") do %> <% if @oidc_identities.any? %>
<% @oidc_identities.each do |identity| %>
<% icon_name = identity.provider_config&.dig(:icon).presence || "key" %> <%= icon icon_name, class: "w-5 h-5 text-secondary" %>

<%= identity.provider_config&.dig(:label) || identity.provider.titleize %>

<%= identity.info&.dig("email") || t(".sso_no_email") %>

<%= t(".sso_last_used") %>: <%= identity.last_authenticated_at&.to_fs(:short) || t(".sso_never") %>

<% if @oidc_identities.count > 1 || Current.user.password_digest.present? %> <%= render DS::Button.new( text: t(".sso_disconnect"), variant: "outline", size: "sm", href: settings_sso_identity_path(identity), method: :delete, confirm: CustomConfirm.new( title: t(".sso_confirm_title"), body: t(".sso_confirm_body", provider: identity.provider_config&.dig(:label) || identity.provider.titleize), btn_text: t(".sso_confirm_button"), destructive: true ) ) %> <% end %>
<% end %>
<% if @oidc_identities.count == 1 && Current.user.password_digest.blank? %>
<%= icon "alert-triangle", class: "w-5 h-5 text-amber-600 shrink-0 mt-0.5" %>

<%= t(".sso_warning_message") %>

<% end %> <% else %>
<%= icon "link", class: "w-12 h-12 mx-auto text-secondary mb-3" %>

<%= t(".sso_no_identities") %>

<%= t(".sso_connect_hint") %>

<% end %> <% end %> <% end %>