From ce8e29e50ac260c1dc0c2ea5d46b27bb547acd1c Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 30 Aug 2021 12:07:56 -0300 Subject: [PATCH] Bug 28772: Display API secret once This patch makes the apikeys.pl display the generated API secret once, when generated. After that, it won't be displayed by the UI. To test: 1. Generate a new API key => FAIL: The secret is displayed in the API keys table 2. Visit some other page, and go back to the API keys page => FAIL: The API key secret is there 3. Apply this patch 4. Go to More > Manage API keys => SUCCESS: It no longer displays the secret 5. Generate a new API key => SUCCESS: The API key details (including the secret) are displayed. => SUCCESS: A message telling to copy the secret because it won't be displayed again is shown. 6. Repeat 4 => SUCCESS: The secret is no longer displayed 7. Sign off :-D Signed-off-by: Martin Renvoize Signed-off-by: Marcel de Rooy Signed-off-by: Wainui Witika-Park --- .../prog/en/modules/members/apikeys.tt | 24 +++++++++++++++++-- members/apikeys.pl | 7 ++++-- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/apikeys.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/apikeys.tt index 3285dc15e0..3ac6fafc03 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/apikeys.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/apikeys.tt @@ -26,6 +26,28 @@ [% INCLUDE 'members-toolbar.inc' %]

API keys for [% INCLUDE 'patron-title.inc' %]

+ + [% IF fresh_api_key %] + [%# A fresh api key was generated, display the secret, only once %] +
+ Make sure to copy your API secret now. You won’t be able to see it again! +
    +
  1. + Description: + [% fresh_api_key.description | html %] +
  2. +
  3. + Client ID: + [% fresh_api_key.client_id | html %] +
  4. +
  5. + Secret: + [% fresh_api_key.plain_text_secret | html %] +
  6. +
+
+ [% END %] +