@page "/Users/{baid:int}/AccessCode"
@inject HttpClient Client
@inject IDialogService DialogService
@inject LoginService LoginService
@inject NavigationManager NavigationManager
Access Code Management
User: @Baid
@if (response is null)
{
}
else
{
@if ((LoginService.LoginRequired && (!LoginService.IsLoggedIn || (LoginService.GetLoggedInUser().Baid != Baid && !LoginService.IsAdmin))) || User is null)
{
You are not authorized to see this page. Please log in by clicking on "Users" tab first.
}
else
{
Bind New Access Code
Enter a new access code to bind to this user account.
Bind
Access Codes
@for (var idx = 0; idx < User.AccessCodes.Count; idx++)
{
var accessCode = User.AccessCodes[idx];
var localIdx = idx + 1;
@foreach (var digitGroup in SplitIntoGroups(accessCode, 4))
{
@digitGroup
}
@Localizer["Delete"]
}
}
}
@code {
List SplitIntoGroups(string str, int groupSize)
{
List groups = new List();
for (int i = 0; i < str.Length; i += groupSize)
{
groups.Add(str.Substring(i, Math.Min(groupSize, str.Length - i)));
}
return groups;
}
}