docbrown/app/views/admin/settings/_apple_auth_provider_settings.html.erb
Michael Kohl dcf942e3a2
Add Admin:Settings controllers (#13851)
* Add Admin:Settings::BaseController and refactor

* Further simplify controllers

* Add comments, more cleanup

* Update mandatory settings controller

* Update spec

* Update service object and spec

* Update controller

* Update app/services/settings/general/upsert.rb

Co-authored-by: Jamie Gaskins <jamie@forem.com>

Co-authored-by: Jamie Gaskins <jamie@forem.com>
2021-06-08 10:13:55 +07:00

77 lines
3.4 KiB
Text

<!--
Apple's config is different compared to the common OAuth provider implemented
before, this makes the generalized `auth_provider_settings` not work well so it
requires a custom partial
-->
<fieldset class="config-authentication-form">
<div
class="crayons-notice crayons-notice--warning auth-warning <%= authentication_provider_enabled?(provider) ? "hidden" : "" %>" aria-live="polite">
<strong>Note:</strong> This authentication provider will <strong>not</strong> be enabled if the key or secret are missing. Please make sure that you enter your key and secret correctly.
</div>
<div class="crayons-field">
<%= admin_config_label :apple_client_id %>
<p class="crayons-field__description">
<%= Constants::Settings::Authentication::DETAILS[:apple_client_id][:description] %>
</p>
<%= f.text_field :apple_client_id,
class: "crayons-textfield",
value: Settings::Authentication.apple_client_id,
placeholder: Constants::Settings::Authentication::DETAILS[:apple_client_id][:placeholder] %>
</div>
<div class="crayons-field">
<%= admin_config_label :apple_key_id %>
<p class="crayons-field__description">
<%= Constants::Settings::Authentication::DETAILS[:apple_key_id][:description] %>
<p>
<%= f.text_field :apple_key_id,
class: "crayons-textfield",
value: Settings::Authentication.apple_key_id,
placeholder: Constants::Settings::Authentication::DETAILS[:apple_key_id][:placeholder] %>
</div>
<div class="crayons-field">
<%= admin_config_label :apple_pem %>
<p class="crayons-field__description">
<%= Constants::Settings::Authentication::DETAILS[:apple_pem][:description] %>
<p>
<%= f.text_field :apple_pem,
class: "crayons-textfield",
value: Settings::Authentication.apple_pem,
placeholder: Constants::Settings::Authentication::DETAILS[:apple_pem][:placeholder] %>
</div>
<div class="crayons-field">
<%= admin_config_label :apple_team_id %>
<p class="crayons-field__description">
<%= Constants::Settings::Authentication::DETAILS[:apple_team_id][:description] %>
<p>
<%= f.text_field :apple_team_id,
class: "crayons-textfield",
value: Settings::Authentication.apple_team_id,
placeholder: Constants::Settings::Authentication::DETAILS[:apple_team_id][:placeholder] %>
</div>
<div class="crayons-btn-actions">
<% if authentication_provider_enabled?(provider) %>
<button
class="crayons-btn crayons-btn--danger"
data-action="click->config#activateAuthProviderModal"
data-tooltip="<%= tooltip_text_email_or_auth_provider_btns %>"
data-provider-name="<%= provider.provider_name %>"
data-provider-official-name="<%= provider.official_name %>"
<%= disabled_attr_on_auth_provider_enable_btn %>>
Disable
</button>
<button
class="crayons-btn crayons-btn--secondary"
data-provider-name="<%= provider.provider_name %>"
data-action="click->config#hideAuthProviderSettings">
Close
</button>
<% else %>
<button
class="crayons-btn crayons-btn--secondary"
data-provider-name="<%= provider.provider_name %>"
data-action="click->config#disableAuthProvider">
Undo
</button>
<% end %>
</div>
</fieldset>