diff --git a/portality/templates/account/view.html b/portality/templates/account/view.html index ab4c8c0de6..dd1c2aa4a2 100644 --- a/portality/templates/account/view.html +++ b/portality/templates/account/view.html @@ -90,7 +90,9 @@

Your API access

{% if account.has_role("api") %}
API Key
- {{ account.api_key }} + {{ account.api_key }} + Copy value +
{% endif %} @@ -121,6 +123,17 @@

Your API access

$(window).scrollTop($(firstError).offset().top - 100) } + {% if account.has_role("api") %} + // Copy API key to clipboard + $('#click-to-copy--api').click(function() { + let value_to_copy = $('#user-api').html(); + navigator.clipboard.writeText(value_to_copy); + var confirmation = $("#copy-confirmation--api"); + confirmation.text("Copied: " + value_to_copy); + confirmation.show().delay(3000).fadeOut(); + }); + {% endif %} + // If the user is editing their own account, make them confirm when email address is updated {% if current_user.id == account.id %} $('form#edit_user').submit(function () {