btcpayserver/BTCPayServer/Views/UIStores/ListTokens.cshtml
d11n 0f8da123b8
UI: Move section navigation to sidebar (#5744)
* UI: Move section navigation to sidebar

* Scroll active nav link into view

* Move CTAs to top right

* Server Settings: Make Policies first page

* Responsive table fixes

* Spacing fixes

* Add breadcrumb samples

* store settings fixes

* payment request fixes

* updates pull payment title

* adds invoice detail fix

* updates server settings breadcrumbs + copy fix

* Don't open Server Settings on Plugins page

* Add breadcrumbs to pull payment views

* adds breadcrumbs to account

* server and store breadcrumb fixes

* fixes access tokens

* Fix payment processor breadcrumbs

* fixes webhook 404

* Final touches

* Fix test

* Add breadcrumb for email rules page

* Design system updates

---------

Co-authored-by: dstrukt <gfxdsign@gmail.com>
2024-06-19 15:23:10 +02:00

101 lines
4.7 KiB
Text

@using BTCPayServer.Abstractions.Models
@using BTCPayServer.Client
@using Microsoft.AspNetCore.Mvc.TagHelpers
@model TokensViewModel
@{
ViewData.SetActivePage(StoreNavPages.Tokens, "Access Tokens", Context.GetStoreData().Id);
}
@if (Model.StoreNotConfigured)
{
<div class="alert alert-warning alert-dismissible mb-5" role="alert">
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
<vc:icon symbol="close" />
</button>
Warning: No wallet has been linked to your BTCPay Server Store.<br/>
See <a href="https://docs.btcpayserver.org/WalletSetup/" target="_blank" class="alert-link" rel="noreferrer noopener">this link</a> for more information on how to connect your store and wallet.
</div>
}
<div class="sticky-header">
<h2 class="my-1">
Greenfield API Keys
<a href="/docs" target="_blank" rel="noreferrer noopener" title="More information...">
<vc:icon symbol="info"/>
</a>
</h2>
</div>
<partial name="_StatusMessage" />
<div class="row">
<div class="col-xxl-constrain col-xl-8">
<p>To generate Greenfield API keys, please <a asp-controller="UIManage" asp-action="APIKeys">click here</a>.</p>
<div class="d-flex align-items-center justify-content-between mt-5 mb-3">
<h3 class="mb-0">@ViewData["Title"]</h3>
<a id="CreateNewToken" asp-action="CreateToken" class="btn btn-primary" role="button" asp-route-storeId="@Context.GetRouteValue("storeId")" permission="@Policies.CanModifyStoreSettings">
Create Token
</a>
</div>
<p>Authorize a public key to access Bitpay compatible Invoice API.
<a href="https://support.bitpay.com/hc/en-us/articles/115003001183-How-do-I-pair-my-client-and-create-a-token-" target="_blank" rel="noreferrer noopener" title="More information...">
<vc:icon symbol="info"/>
</a>
</p>
@if (Model.Tokens.Any())
{
<div class="table-responsive-md">
<table class="table table-hover">
<thead>
<tr>
<th>Label</th>
<th class="text-end" permission="@Policies.CanModifyStoreSettings">Actions</th>
</tr>
</thead>
<tbody>
@foreach (var token in Model.Tokens)
{
<tr>
<td>@token.Label</td>
<td class="text-end" permission="@Policies.CanModifyStoreSettings">
<a asp-action="ShowToken" asp-route-storeId="@Context.GetRouteValue("storeId")" asp-route-tokenId="@token.Id">See information</a> -
<a asp-action="RevokeToken" asp-route-storeId="@Context.GetRouteValue("storeId")" asp-route-tokenId="@token.Id" data-bs-toggle="modal" data-bs-target="#ConfirmModal" data-description="The access token with the label <strong>@Html.Encode(token.Label)</strong> will be revoked." data-confirm-input="REVOKE">Revoke</a>
</td>
</tr>
}
</tbody>
</table>
</div>
}
else
{
<p class="text-secondary mt-3">
No access tokens yet.
</p>
}
<h3 class="mt-5 mb-3">Legacy API Keys</h3>
<p>Alternatively, you can use the invoice API by including the following HTTP Header in your requests:</p>
<p><code>Authorization: Basic @Model.EncodedApiKey</code></p>
<form method="post" asp-action="GenerateAPIKey" asp-route-storeId="@Context.GetRouteValue("storeId")" permission="@Policies.CanModifyStoreSettings">
<div class="form-group">
<label asp-for="ApiKey" class="form-label"></label>
<div class="d-flex">
<input asp-for="ApiKey" readonly class="form-control"/>
@if (string.IsNullOrEmpty(Model.ApiKey))
{
<button class="btn btn-primary ms-3" type="submit">Generate</button>
}
else
{
<button class="btn btn-danger ms-3" type="submit" name="command" value="revoke">Revoke</button>
<button class="btn btn-primary ms-3" type="submit">Regenerate</button>
}
</div>
</div>
</form>
</div>
</div>
<partial name="_Confirm" model="@(new ConfirmModel("Revoke access token", "The access token will be revoked. Do you wish to continue?", "Revoke"))" permission="@Policies.CanModifyStoreSettings" />