mirror of https://github.com/docusealco/docuseal
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
3.8 KiB
66 lines
3.8 KiB
<%= content_for(:canonical_url, new_user_session_url) %>
|
|
<div class="max-w-lg mx-auto px-2">
|
|
<%= render 'devise/shared/select_server' if Docuseal.multitenant? %>
|
|
<h1 class="text-4xl font-bold text-center mt-8"><%= t('sign_in') %></h1>
|
|
<%= form_for(resource, as: resource_name, html: { class: 'space-y-6' }, data: { turbo: params[:redir].blank? }, url: session_path(resource_name)) do |f| %>
|
|
<%= render 'hidden_fields' %>
|
|
<div class="space-y-2" dir="auto">
|
|
<div class="form-control">
|
|
<%= f.label :email, t(:email), class: 'label' %>
|
|
<%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'base-input' %>
|
|
</div>
|
|
<div class="form-control">
|
|
<%= f.label :password, t(:password), class: 'label' %>
|
|
<%= f.password_field :password, autocomplete: 'current-password', class: 'base-input' %>
|
|
</div>
|
|
</div>
|
|
<div class="form-control">
|
|
<%= f.button button_title(title: t(:sign_in), disabled_with: t(:signing_in)), class: 'base-button' %>
|
|
</div>
|
|
<% end %>
|
|
<% if devise_mapping.omniauthable? %>
|
|
<div class="space-y-4">
|
|
<% if User.omniauth_providers.include?(:google_oauth2) && Rails.application.credentials.google_client_id.present? && Rails.application.credentials.google_client_id != 'placeholder_client_id' %>
|
|
<%= form_for '', url: '/auth/google_oauth2', data: { turbo: false }, method: :post do |f| %>
|
|
<set-timezone data-input-id="state" data-params="true"></set-timezone>
|
|
<%= hidden_field_tag :state, { redir: params[:redir].to_s }.compact_blank.to_query %>
|
|
<%= f.button button_title(title: t('sign_in_with_google'), icon: svg_icon('brand_google', class: 'w-6 h-6')), class: 'white-button w-full mt-4' %>
|
|
<% end %>
|
|
<% end %>
|
|
<% if User.omniauth_providers.include?(:microsoft_graph) && Rails.application.credentials.microsoft_client_id.present? && Rails.application.credentials.microsoft_client_id != 'placeholder_client_id' %>
|
|
<%= form_for '', url: '/auth/microsoft_graph', data: { turbo: false }, method: :post do |f| %>
|
|
<set-timezone data-input-id="state_microsoft" data-params="true"></set-timezone>
|
|
<%= hidden_field_tag :state, { redir: params[:redir].to_s }.compact_blank.to_query, id: 'state_microsoft' %>
|
|
<%= f.button button_title(title: t('sign_in_with_microsoft'), icon: svg_icon('brand_microsoft', class: 'w-6 h-6')), class: 'white-button w-full' %>
|
|
<% end %>
|
|
<% end %>
|
|
<%
|
|
# Check if SAML is configured (either in ENV or database)
|
|
saml_configured = false
|
|
if ENV['SAML_IDP_SSO_SERVICE_URL'].present? && ENV['SAML_IDP_CERT_FINGERPRINT'].present?
|
|
saml_configured = true
|
|
else
|
|
saml_config_record = EncryptedConfig.find_by(key: 'saml_configs')
|
|
if saml_config_record&.value.present?
|
|
begin
|
|
config = JSON.parse(saml_config_record.value)
|
|
saml_configured = config['idp_sso_service_url'].present? && config['idp_cert_fingerprint'].present?
|
|
rescue JSON::ParserError
|
|
# Invalid JSON, treat as not configured
|
|
end
|
|
end
|
|
end
|
|
%>
|
|
<% if User.omniauth_providers.include?(:saml) && saml_configured %>
|
|
<%= form_for '', url: '/auth/saml', data: { turbo: false }, method: :post do |f| %>
|
|
<set-timezone data-input-id="state_saml" data-params="true"></set-timezone>
|
|
<%= hidden_field_tag :state, { redir: params[:redir].to_s }.compact_blank.to_query, id: 'state_saml' %>
|
|
<%= f.button button_title(title: 'Sign in with SAML SSO', icon: svg_icon('certificate', class: 'w-6 h-6')), class: 'white-button w-full' %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
<%= render 'extra_links' %>
|
|
<%= render 'devise/shared/links' %>
|
|
</div>
|