Regenerate the secret

This commit is contained in:
Paul Schneider 2026-06-19 01:36:08 +01:00
commit 19cf073677
10 changed files with 199 additions and 16 deletions

View file

@ -0,0 +1,39 @@
@model Client
<h2>@Localizer["Regenerate client secret"]</h2>
<div class="alert alert-warning" role="alert">
<strong>@Localizer["Warning."]</strong>
@Localizer["Regenerating the secret will immediately invalidate the current one. Any client using the existing secret will be unable to authenticate until it is updated with the new value. The new secret will be displayed exactly once and cannot be recovered afterwards."]
</div>
<div>
<h4>@Model.ClientName</h4>
<hr />
<dl class="dl-horizontal">
<dt>@Html.DisplayNameFor(model => model.ClientId)</dt>
<dd>@Html.DisplayFor(model => model.ClientId)</dd>
<dt>@Localizer["Current secrets"]</dt>
<dd>
@if (Model.ClientSecrets != null && Model.ClientSecrets.Count > 0)
{
<ul>
@foreach (var secret in Model.ClientSecrets)
{
<li>@secret.Description <small class="text-muted">(created @secret.Created.ToString("u"))</small></li>
}
</ul>
}
else
{
<em>@Localizer["No secret currently set."]</em>
}
</dd>
</dl>
</div>
<form asp-action="RegenerateSecret" asp-route-id="@Model.Id" method="post">
@Html.AntiForgeryToken()
<button type="submit" class="btn btn-danger">@Localizer["Regenerate now"]</button>
<a asp-action="Details" asp-route-id="@Model.Id" class="btn btn-default">@Localizer["Cancel"]</a>
</form>