scinote-web/app/views/users/registrations/edit_partials/_api_key.html.erb
2024-05-24 12:36:01 +02:00

24 lines
1.1 KiB
Text

<div class="api-key-container">
<h3 class="title"><%= t("users.registrations.edit.api_key.title") %></h3>
<div class="description">
<%= t("users.registrations.edit.api_key.description") %>
</div>
<% if current_user.api_key %>
<div class="api-key-display">
<%= text_field_tag :api_key, current_user.api_key, class: "api-key-field", disabled: "disabled" %>
<% if current_user.api_key_expires_at < Time.current %>
<p class="api-key-error">
<%= t("users.registrations.edit.api_key.expired") %>
</p>
<% end %>
</div>
<% end %>
<div class="api-key-controls">
<% if current_user.api_key %>
<%= button_to t("users.registrations.edit.api_key.regenerate"), users_api_key_regenerate_path, class: "btn btn-primary" %>
<%= 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>