Files
sure/app/views/oidc_accounts/link.html.erb
LPW b23711ae0d Add configurable multi-provider SSO, SSO-only mode, and JIT controls via auth.yml (#441)
* Add configuration and logic for dynamic SSO provider support and stricter JIT account creation

- Introduced `config/auth.yml` for centralized auth configuration and documentation.
- Added support for multiple SSO providers, including Google, GitHub, and OpenID Connect.
- Implemented stricter JIT SSO account creation modes (`create_and_link` vs `link_only`).
- Enabled optional restriction of JIT creation by allowed email domains.
- Enhanced OmniAuth initializer for dynamic provider setup and better configurability.
- Refined login UI to handle local login disabling and emergency super-admin override.
- Updated account creation flow to respect JIT mode and domain checks.
- Added tests for SSO account creation, login form visibility, and emergency overrides.

# Conflicts:
#	app/controllers/sessions_controller.rb

* remove non-translation

* Refactor authentication views to use translation keys and update locale files

- Extracted hardcoded strings in `oidc_accounts/link.html.erb` and `sessions/new.html.erb` into translation keys for better localization support.
- Added missing translations for English and Spanish in `sessions` and `oidc_accounts` locale files.

* Enhance OmniAuth provider configuration and refine local login override logic

- Updated OmniAuth initializer to support dynamic provider configuration with `name` and scoped parameters for Google and GitHub.
- Improved local login logic to enforce stricter handling of super-admin override when local login is disabled.
- Added test for invalid super-admin override credentials.

* Document Google sign-in configuration for local development and self-hosted environments

---------

Co-authored-by: Josh Waldrep <joshua.waldrep5+github@gmail.com>
2025-12-24 00:15:53 +01:00

81 lines
2.6 KiB
Plaintext

<%
header_title @user_exists ? "Link OIDC Account" : "Create Account"
%>
<% if @user_exists %>
<div class="mb-6 p-4 bg-yellow-50 border border-yellow-200 rounded-md">
<h3 class="text-sm font-medium text-yellow-800 mb-2">Verify Your Identity</h3>
<p class="text-sm text-yellow-700">
To link your <%= @pending_auth["provider"] %> account<% if @pending_auth["email"].present? %> (<%= @pending_auth["email"] %>)<% end %>,
please verify your identity by entering your password.
</p>
</div>
<%= styled_form_with url: create_link_oidc_account_path, class: "space-y-4", data: { turbo: false } do |form| %>
<%= form.email_field :email,
label: "Email",
autofocus: false,
autocomplete: "email",
required: "required",
placeholder: "Enter your email",
value: @email %>
<%= form.password_field :password,
label: "Password",
required: "required",
placeholder: "Enter your password",
autocomplete: "current-password" %>
<div class="text-sm text-gray-600 mt-2">
<p>This helps ensure that only you can link external accounts to your profile.</p>
</div>
<%= form.submit "Link Account" %>
<% end %>
<% else %>
<div class="mb-6 p-4 bg-blue-50 border border-blue-200 rounded-md">
<h3 class="text-sm font-medium text-blue-800 mb-2">Create New Account</h3>
<p class="text-sm text-blue-700">
No account found with the email <strong><%= @pending_auth["email"] %></strong>.
Click below to create a new account using your <%= @pending_auth["provider"] %> identity.
</p>
</div>
<div class="space-y-4">
<div class="p-4 bg-container border border-secondary rounded-md">
<p class="text-sm text-primary">
<strong>Email:</strong> <%= @pending_auth["email"] %>
</p>
<% if @pending_auth["name"].present? %>
<p class="text-sm text-primary mt-2">
<strong>Name:</strong> <%= @pending_auth["name"] %>
</p>
<% end %>
</div>
<% if @allow_account_creation %>
<%= render DS::Button.new(
text: "Create Account",
href: create_user_oidc_account_path,
full_width: true,
variant: :primary,
method: :post,
data: { turbo: false }
) %>
<% else %>
<p class="text-xs text-secondary">
<%= t("oidc_accounts.link.account_creation_disabled") %>
</p>
<% end %>
</div>
<% end %>
<div class="mt-6 text-center">
<%= render DS::Link.new(
text: "Cancel",
href: new_session_path,
variant: :default,
class: "font-medium text-sm text-primary hover:underline transition"
) %>
</div>