Files
sure/app/views/sessions/new.html.erb
Guillem Arias Fauste 211e407456 fix(ds): migrate remaining amber notice boxes to DS::Alert(:warning) (#2247)
Continues the #2198 warning consolidation (after the SSO surfaces).
Replaces the last hand-rolled bg-amber-50 notice boxes with DS::Alert:

- pages/redis_configuration_error: "why Redis is required" callout →
  DS::Alert(title:, message:, variant: :warning).
- family_exports/new: export "Note" callout → DS::Alert(title:, message:).
- sessions/new: "no auth methods enabled" notice → DS::Alert(message:).

The DS::Alert warning recipe (warning tint + neutral text + alert-triangle)
replaces the literal amber palette while preserving each notice's intent.

Part of #2198. After this, the only remaining raw amber-* is the dynamic
validation feedback in admin_sso_form_controller.js (deferred — JS form
state styling, a separate concern).
2026-06-11 15:25:33 +02:00

86 lines
3.2 KiB
Plaintext

<% if @prefill_demo_credentials %>
<div class="mb-4 rounded-lg border bg-blue-50 text-blue-700 border-blue-200 theme-dark:bg-blue-900/20 theme-dark:text-blue-400 theme-dark:border-blue-800 p-4" role="status" aria-live="polite">
<div class="flex items-start gap-3">
<div class="shrink-0">
<%= icon "info", size: "sm", color: "blue-600" %>
</div>
<div class="flex-1 text-sm">
<h3 class="font-semibold mb-1">
<%= t(".demo_banner_title") %>
</h3>
<p>
<%= t(".demo_banner_message") %>
</p>
</div>
</div>
</div>
<% end %>
<% if AuthConfig.local_login_form_visible? %>
<%= styled_form_with url: sessions_path, class: "space-y-4", data: { turbo: false } do |form| %>
<%= form.email_field :email,
label: t(".email"),
autofocus: false,
autocomplete: "email",
required: "required",
placeholder: t(".email_placeholder"),
value: @email %>
<%= form.password_field :password,
label: t(".password"),
required: "required",
placeholder: t(".password_placeholder"),
value: @password %>
<%= form.submit t(".submit") %>
<% end %>
<% unless AuthConfig.local_login_enabled? %>
<p class="mt-2 text-xs text-secondary text-center">
<%= t(".local_login_admin_only") %>
</p>
<% end %>
<% if AuthConfig.password_features_enabled? %>
<div class="mt-6 text-center">
<%= link_to t(".forgot_password"), new_password_reset_path, class: "font-medium text-sm text-primary hover:underline transition" %>
</div>
<% end %>
<% end %>
<% providers = AuthConfig.sso_providers %>
<% if providers.any? %>
<div class="mt-6 space-y-3">
<% providers.each do |provider| %>
<% provider_id = provider[:id].to_s %>
<% provider_name = provider[:name].to_s %>
<% is_google = provider_id == "google" || provider[:strategy].to_s == "google_oauth2" %>
<% default_label = is_google ? t(".google_auth_connect") : t(".#{provider_id}", default: provider[:name].to_s.titleize) %>
<%#
SSO buttons use the design-system outline button so they stay consistent
with each other and read as secondary to the primary email "Log in" CTA.
Google keeps its official multi-color "G" mark + "Sign in with Google"
wording (brand-compliant) via the custom-icon asset, so no bespoke CSS.
%>
<%= render DS::Button.new(
href: "/auth/#{provider_name}",
method: :post,
variant: :outline,
size: :md,
full_width: true,
icon: is_google ? "google-icon" : provider[:icon].presence,
icon_custom: is_google,
text: provider[:label].presence || default_label,
class: "gap-2",
form: { data: { turbo: false } }
) %>
<% end %>
</div>
<% elsif !AuthConfig.local_login_form_visible? %>
<div class="mt-6">
<%= render DS::Alert.new(message: t(".no_auth_methods_enabled"), variant: :warning) %>
</div>
<% end %>