scinote-web/app/views/users/registrations/edit_partials/_api_key.html.erb
2024-06-03 13:47:00 +02:00

32 lines
1.4 KiB
Text

<div class="mb-8">
<h3 id="api-key"><%= t("users.registrations.edit.api_key.title") %></h3>
<p>
<%= t("users.registrations.edit.api_key.description") %>
</p>
<% if current_user.api_key %>
<div class="api-key-display">
<div class="form-group sci-input-container right-icon !w-1/2">
<%= password_field_tag :api_key,
current_user.api_key,
name: 'api_key',
class: 'form-control sci-input-field !text-sn-black !font-mono !cursor-text',
disabled: 'disabled'
%>
<i class="sn-icon sn-icon-visibility-show show-password" style="cursor: pointer; z-index: 10"></i>
</div>
<% if current_user.api_key_expires_at < Time.current %>
<p class="">
<%= t("users.registrations.edit.api_key.expired") %>
</p>
<% end %>
</div>
<% end %>
<div class="flex">
<% if current_user.api_key %>
<%= button_to t("users.registrations.edit.api_key.regenerate"), users_api_key_regenerate_path, class: "btn btn-primary mr-2" %>
<%= button_to t("users.registrations.edit.api_key.revoke"), users_api_key_revoke_path, class: "btn btn-danger" %>
<% else %>
<%= button_to t("users.registrations.edit.api_key.generate"), users_api_key_regenerate_path, class: "btn btn-primary" %>
<% end %>
</div>
</div>