2022-07-15 05:38:33 +02:00
@using BTCPayServer.Abstractions.Models
2020-11-05 14:09:43 +01:00
@model TokensViewModel
2017-09-13 16:50:36 +02:00
@{
2017-10-27 10:53:04 +02:00
Layout = "../Shared/_NavLayout.cshtml";
2021-12-31 08:36:38 +01:00
ViewData.SetActivePage(StoreNavPages.Tokens, "Access Tokens", Context.GetStoreData().Id);
2017-09-13 16:50:36 +02:00
}
2019-01-18 11:15:31 +01:00
@if (Model.StoreNotConfigured)
{
2020-07-22 15:29:58 +02:00
<div class="alert alert-warning alert-dismissible mb-5" role="alert">
2021-05-19 04:39:27 +02:00
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
<vc:icon symbol="close" />
</button>
2020-07-22 15:29:58 +02:00
Warning: No wallet has been linked to your BTCPay Store.<br/>
2021-07-06 10:35:42 +02:00
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.
2019-01-18 11:15:31 +01:00
</div>
}
2021-04-08 15:32:42 +02:00
2018-04-29 11:28:04 +02:00
<div class="row">
2022-01-27 03:56:46 +01:00
<div class="col-xxl-constrain col-xl-8">
2021-04-08 15:32:42 +02:00
<div class="d-flex align-items-center justify-content-between mb-3">
2021-12-16 11:17:02 +01:00
<h3 class="mb-0">@ViewData["Title"]</h3>
2021-04-08 15:32:42 +02:00
<a id="CreateNewToken" asp-action="CreateToken" class="btn btn-primary" role="button" asp-route-storeId="@Context.GetRouteValue("storeId")">
<span class="fa fa-plus"></span>
2021-12-28 07:54:31 +01:00
Create Token
2021-04-08 15:32:42 +02:00
</a>
</div>
<p>Authorize a public key to access Bitpay compatible Invoice API.
2023-02-13 09:25:24 +01:00
<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"/>
2021-04-08 15:32:42 +02:00
</a>
</p>
2020-07-22 15:29:58 +02:00
@if (Model.Tokens.Any())
{
2021-08-20 14:59:31 +02:00
<table class="table table-hover table-responsive-md">
2020-07-22 15:29:58 +02:00
<thead>
2018-04-29 11:28:04 +02:00
<tr>
<th>Label</th>
2021-05-19 04:39:27 +02:00
<th class="text-end">Actions</th>
2018-04-29 11:28:04 +02:00
</tr>
2020-07-22 15:29:58 +02:00
</thead>
<tbody>
2019-01-18 11:15:31 +01:00
@foreach (var token in Model.Tokens)
2018-04-29 11:28:04 +02:00
{
<tr>
<td>@token.Label</td>
2021-05-19 04:39:27 +02:00
<td class="text-end">
2021-09-07 04:55:53 +02:00
<a asp-action="ShowToken" asp-route-storeId="@Context.GetRouteValue("storeId")" asp-route-tokenId="@token.Id">See information</a> -
2023-01-21 19:08:12 +01:00
<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>
2018-04-29 11:28:04 +02:00
</td>
</tr>
}
2020-07-22 15:29:58 +02:00
</tbody>
</table>
}
2021-04-08 15:32:42 +02:00
else
{
<p class="text-secondary mt-3">
2021-11-18 10:04:20 +01:00
No access tokens yet.
2021-04-08 15:32:42 +02:00
</p>
}
2018-04-29 11:28:04 +02:00
2021-11-18 10:04:20 +01:00
<h3 class="mt-5 mb-3">Legacy API Keys</h3>
2021-04-08 15:32:42 +02:00
<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")">
2018-04-29 11:28:04 +02:00
<div class="form-group">
2021-05-19 04:39:27 +02:00
<label asp-for="ApiKey" class="form-label"></label>
2021-11-18 10:04:20 +01:00
<div class="d-flex">
2020-02-21 05:40:00 +01:00
<input asp-for="ApiKey" readonly class="form-control"/>
@if (string.IsNullOrEmpty(Model.ApiKey))
{
2022-12-20 15:11:22 +01:00
<button class="btn btn-primary ms-3" type="submit">Generate</button>
2020-02-21 05:40:00 +01:00
}
else
{
2021-11-18 10:04:20 +01:00
<button class="btn btn-danger ms-3" type="submit" name="command" value="revoke">Revoke</button>
2022-12-20 15:11:22 +01:00
<button class="btn btn-primary ms-3" type="submit">Regenerate</button>
2020-02-21 05:40:00 +01:00
}
2020-06-11 16:09:33 +02:00
</div>
2018-04-29 11:28:04 +02:00
</div>
</form>
</div>
</div>
2021-09-07 04:55:53 +02:00
2021-12-16 11:17:02 +01:00
<partial name="_Confirm" model="@(new ConfirmModel("Revoke access token", "The access token will be revoked. Do you wish to continue?", "Revoke"))" />