Skip to content

Commit 6164730

Browse files
committed
add warning message to tokeninfo to indicate users must copy mytoken; close #156
1 parent 704f5e2 commit 6164730

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

internal/server/web/partials/tokeninfo.mustache

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@
5858
<i class="fas fa-trash"></i>
5959
</button>
6060
</div>
61+
62+
<div class="alert alert-dismissible alert-danger mt-3 d-none" id="token-gone-warning">
63+
<button type="button" class="close" data-dismiss="alert">&times;</button>
64+
<h4 class="alert-heading">Do not loose access to your mytoken!</h4>
65+
<p>To keep access to your mytoken you <strong>must</strong> copy it to a safe location, as
66+
you will not be able to retrieve it again from this website.</p>
67+
</div>
6168
</div>
6269

6370
<div class="card-header mt-3">

internal/server/web/static/js/tokeninfo-status.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,23 @@ const $tokeninfoBadgeIat = $('#tokeninfo-token-iat');
1212
const $tokeninfoBadgeExp = $('#tokeninfo-token-exp');
1313
const $tokeninfoBadgeIatDate = $('#tokeninfo-token-iat-date');
1414
const $tokeninfoBadgeExpDate = $('#tokeninfo-token-exp-date');
15-
1615
const $tokeninfoTypeBadges = $('.tokeninfo-token-type');
16+
const $tokeninfoTokenGoneWarningMsg = $('#token-gone-warning');
1717

18+
$('#tokeninfo-token-copy').on('click', function () {
19+
if (!$tokeninfoTokenGoneWarningMsg.hasClass('d-none')) {
20+
$tokeninfoTokenGoneWarningMsg.alert('close');
21+
}
22+
});
1823

1924
async function update_tokeninfo() {
2025
let token = storagePop('tokeninfo_token', true);
2126
if (token === "") {
2227
token = $tokenInput.val();
28+
$tokeninfoTokenGoneWarningMsg.hideB();
2329
} else {
2430
$tokenInput.val(token);
31+
$tokeninfoTokenGoneWarningMsg.showB();
2532
}
2633
let payload = {};
2734
if (token === "") {

0 commit comments

Comments
 (0)