Got most of admin panel working. Data issues fixed

This commit is contained in:
Vincent Allen
2025-09-02 09:27:23 -04:00
parent dd3968f6ef
commit ff34eb87b9
401 changed files with 10478 additions and 10675 deletions

View File

@@ -1,14 +1,14 @@
using System.Security.Claims;
using System.Text.Json;
using OpenArchival.Blazor.Components.Account.Pages.Manage;
using OpenArchival.Blazor.Components.Account.Pages;
using OpenArchival.DataAccess;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using OpenArchival.Blazor.Components.Account.Pages;
using OpenArchival.Blazor.Components.Account.Pages.Manage;
using OpenArchival.Blazor.Data;
using System.Security.Claims;
using System.Text.Json;
namespace Microsoft.AspNetCore.Routing
{

View File

@@ -1,8 +1,8 @@
using OpenArchival.DataAccess;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.UI.Services;
using OpenArchival.Blazor.Data;
namespace OpenArchival.Blazor.Components.Account
namespace MyAppName.WebApp.Components.Account
{
// Remove the "else if (EmailSender is IdentityNoOpEmailSender)" block from RegisterConfirmation.razor after updating with a real implementation.
internal sealed class IdentityNoOpEmailSender : IEmailSender<ApplicationUser>

View File

@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Components;
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNetCore.Components;
namespace OpenArchival.Blazor.Components.Account
namespace MyAppName.WebApp.Components.Account
{
internal sealed class IdentityRedirectManager(NavigationManager navigationManager)
{

View File

@@ -1,11 +1,11 @@
using System.Security.Claims;
using OpenArchival.DataAccess;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Server;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
using OpenArchival.Blazor.Data;
using System.Security.Claims;
namespace OpenArchival.Blazor.Components.Account
namespace MyAppName.WebApp.Components.Account
{
// This is a server-side AuthenticationStateProvider that revalidates the security stamp for the connected user
// every 30 minutes an interactive circuit is connected.

View File

@@ -1,7 +1,7 @@
using OpenArchival.DataAccess;
using Microsoft.AspNetCore.Identity;
using OpenArchival.Blazor.Data;
namespace OpenArchival.Blazor.Components.Account
namespace MyAppName.WebApp.Components.Account
{
internal sealed class IdentityUserAccessor(UserManager<ApplicationUser> userManager, IdentityRedirectManager redirectManager)
{

View File

@@ -2,4 +2,7 @@
<PageTitle>Access denied</PageTitle>
<MudAlert Severity="Severity.Error">You do not have access to this resource.</MudAlert>
<header>
<h1 class="text-danger">Access denied</h1>
<p class="text-danger">You do not have access to this resource.</p>
</header>

View File

@@ -3,7 +3,8 @@
@using System.Text
@using Microsoft.AspNetCore.Identity
@using Microsoft.AspNetCore.WebUtilities
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject UserManager<ApplicationUser> UserManager
@inject IdentityRedirectManager RedirectManager

View File

@@ -3,7 +3,8 @@
@using System.Text
@using Microsoft.AspNetCore.Identity
@using Microsoft.AspNetCore.WebUtilities
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject UserManager<ApplicationUser> UserManager
@inject SignInManager<ApplicationUser> SignInManager

View File

@@ -6,7 +6,9 @@
@using System.Text.Encodings.Web
@using Microsoft.AspNetCore.Identity
@using Microsoft.AspNetCore.WebUtilities
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@using OpenArchival.Blazor.Components.Account.Pages;
@inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager
@@ -21,7 +23,7 @@
<StatusMessage Message="@message" />
<h1>Register</h1>
<h2>Associate your @ProviderDisplayName account.</h2>
<MudDivider />
<hr />
<div class="alert alert-info">
You've successfully authenticated with <strong>@ProviderDisplayName</strong>.
@@ -105,8 +107,8 @@
// Sign in the user with this external login provider if the user already has a login.
var result = await SignInManager.ExternalLoginSignInAsync(
externalLoginInfo!.LoginProvider,
externalLoginInfo!.ProviderKey,
externalLoginInfo.LoginProvider,
externalLoginInfo.ProviderKey,
isPersistent: false,
bypassTwoFactor: true);
@@ -174,7 +176,7 @@
message = $"Error: {string.Join(",", result.Errors.Select(error => error.Description))}";
}
private static ApplicationUser CreateUser()
private ApplicationUser CreateUser()
{
try
{

View File

@@ -5,7 +5,8 @@
@using System.Text.Encodings.Web
@using Microsoft.AspNetCore.Identity
@using Microsoft.AspNetCore.WebUtilities
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject UserManager<ApplicationUser> UserManager
@inject IEmailSender<ApplicationUser> EmailSender
@@ -14,24 +15,24 @@
<PageTitle>Forgot your password?</PageTitle>
<MudText Typo="Typo.h3" GutterBottom="true">Forgot your password?</MudText>
<MudText Typo="Typo.body1" GutterBottom="true">Enter your email.</MudText>
<h1>Forgot your password?</h1>
<h2>Enter your email.</h2>
<hr />
<div class="row">
<div class="col-md-4">
<EditForm Model="Input" FormName="forgot-password" OnValidSubmit="OnValidSubmitAsync" method="post">
<DataAnnotationsValidator />
<ValidationSummary class="text-danger" role="alert" />
<EditForm Model="Input" FormName="forgot-password" OnValidSubmit="OnValidSubmitAsync" method="post">
<DataAnnotationsValidator />
<MudGrid>
<MudItem md="12">
<MudTextField @bind-Value="Input.Email" For="@(() => Input.Email)"
Label="Email" Placeholder="name@example.com"
UserAttributes="@(new() { { "autocomplete", "username" }, { "aria-required", "true" } } )" />
</MudItem>
<MudItem md="12">
<MudButton Variant="Variant.Filled" Color="Color.Primary" FullWidth="true" FormAction="FormAction.Submit">Reset password</MudButton>
</MudItem>
</MudGrid>
</EditForm>
<div class="form-floating mb-3">
<InputText @bind-Value="Input.Email" id="Input.Email" class="form-control" autocomplete="username" aria-required="true" placeholder="name@example.com" />
<label for="Input.Email" class="form-label">Email</label>
<ValidationMessage For="() => Input.Email" class="text-danger" />
</div>
<button type="submit" class="w-100 btn btn-lg btn-primary">Reset password</button>
</EditForm>
</div>
</div>
@code {
[SupplyParameterFromForm]

View File

@@ -2,6 +2,7 @@
<PageTitle>Forgot password confirmation</PageTitle>
<MudText Typo="Typo.h3" GutterBottom="true">Forgot password confirmation</MudText>
<MudText Typo="Typo.body1" GutterBottom="true">Please check your email to reset your password.</MudText>
<h1>Forgot password confirmation</h1>
<p role="alert">
Please check your email to reset your password.
</p>

View File

@@ -3,7 +3,8 @@
@using System.ComponentModel.DataAnnotations
@using Microsoft.AspNetCore.Authentication
@using Microsoft.AspNetCore.Identity
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject SignInManager<ApplicationUser> SignInManager
@inject ILogger<Login> Logger
@@ -12,50 +13,57 @@
<PageTitle>Log in</PageTitle>
<MudText Typo="Typo.h3" GutterBottom="true">Log in</MudText>
<MudGrid>
<MudItem md="6">
<StatusMessage Message="@errorMessage" />
<EditForm Model="Input" method="post" OnValidSubmit="LoginUser" FormName="login">
<DataAnnotationsValidator />
<MudText GutterBottom="true" Typo="Typo.body1">Use a local account to log in.</MudText>
<MudGrid>
<MudItem md="12">
<MudTextField For="@(() => Input.Email)" @bind-Value="Input.Email"
Label="Email" Placeholder="name@example.com"
UserAttributes="@(new() { { "autocomplete", "username" }, { "aria-required", "true" } } )" />
</MudItem>
<MudItem md="12">
<MudTextField For="@(() => Input.Password)" @bind-Value="Input.Password"
Label="Password" InputType="InputType.Password" Placeholder="password"
UserAttributes="@(new() { { "autocomplete", "current-password" }, { "aria-required", "true" } } )" />
</MudItem>
<MudItem md="12">
<MudCheckBox For="@(() => Input.RememberMe)" @bind-Value="Input.RememberMe">Remember me</MudCheckBox>
</MudItem>
<MudItem md="12">
<MudButton Variant="Variant.Filled" Color="Color.Primary" FullWidth="true" FormAction="FormAction.Submit">Log in</MudButton>
</MudItem>
</MudGrid>
</EditForm>
<MudGrid Class="mt-4">
<MudItem md="12">
<MudLink Href="Account/ForgotPassword">Forgot your password?</MudLink><br />
<MudLink Href="@(NavigationManager.GetUriWithQueryParameters("Account/Register", new Dictionary<string, object?> { ["ReturnUrl"] = ReturnUrl }))">Register as a new user</MudLink><br />
<MudLink Href="Account/ResendEmailConfirmation">Resend email confirmation</MudLink>
</MudItem>
</MudGrid>
</MudItem>
<MudItem md="6">
<MudText GutterBottom="true" Typo="Typo.body1">Use another service to log in.</MudText>
<ExternalLoginPicker />
</MudItem>
</MudGrid>
<h1>Log in</h1>
<div class="row">
<div class="col-lg-6">
<section>
<StatusMessage Message="@errorMessage" />
<EditForm Model="Input" method="post" OnValidSubmit="LoginUser" FormName="login">
<DataAnnotationsValidator />
<h2>Use a local account to log in.</h2>
<hr />
<ValidationSummary class="text-danger" role="alert" />
<div class="form-floating mb-3">
<InputText @bind-Value="Input.Email" id="Input.Email" class="form-control" autocomplete="username" aria-required="true" placeholder="name@example.com" />
<label for="Input.Email" class="form-label">Email</label>
<ValidationMessage For="() => Input.Email" class="text-danger" />
</div>
<div class="form-floating mb-3">
<InputText type="password" @bind-Value="Input.Password" id="Input.Password" class="form-control" autocomplete="current-password" aria-required="true" placeholder="password" />
<label for="Input.Password" class="form-label">Password</label>
<ValidationMessage For="() => Input.Password" class="text-danger" />
</div>
<div class="checkbox mb-3">
<label class="form-label">
<InputCheckbox @bind-Value="Input.RememberMe" class="darker-border-checkbox form-check-input" />
Remember me
</label>
</div>
<div>
<button type="submit" class="w-100 btn btn-lg btn-primary">Log in</button>
</div>
<div>
<p>
<a href="Account/ForgotPassword">Forgot your password?</a>
</p>
<p>
<a href="@(NavigationManager.GetUriWithQueryParameters("Account/Register", new Dictionary<string, object?> { ["ReturnUrl"] = ReturnUrl }))">Register as a new user</a>
</p>
<p>
<a href="Account/ResendEmailConfirmation">Resend email confirmation</a>
</p>
</div>
</EditForm>
</section>
</div>
<div class="col-lg-4 col-lg-offset-2">
<section>
<h3>Use another service to log in.</h3>
<hr />
<ExternalLoginPicker />
</section>
</div>
</div>
@code {
private string? errorMessage;

View File

@@ -2,7 +2,8 @@
@using System.ComponentModel.DataAnnotations
@using Microsoft.AspNetCore.Identity
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager
@@ -12,7 +13,7 @@
<PageTitle>Two-factor authentication</PageTitle>
<h1>Two-factor authentication</h1>
<MudDivider />
<hr />
<StatusMessage Message="@message" />
<p>Your login is protected with an authenticator app. Enter your authenticator code below.</p>
<div class="row">
@@ -41,7 +42,7 @@
</div>
<p>
Don't have access to your authenticator device? You can
<a class="mud-link mud-primary-text mud-link-underline-hover" href="Account/LoginWithRecoveryCode?ReturnUrl=@ReturnUrl">log in with a recovery code</a>.
<a href="Account/LoginWithRecoveryCode?ReturnUrl=@ReturnUrl">log in with a recovery code</a>.
</p>
@code {

View File

@@ -2,7 +2,8 @@
@using System.ComponentModel.DataAnnotations
@using Microsoft.AspNetCore.Identity
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager
@@ -12,7 +13,7 @@
<PageTitle>Recovery code verification</PageTitle>
<h1>Recovery code verification</h1>
<MudDivider />
<hr />
<StatusMessage Message="@message" />
<p>
You have requested to log in with a recovery code. This login will not be remembered until you provide
@@ -24,8 +25,8 @@
<DataAnnotationsValidator />
<ValidationSummary class="text-danger" role="alert" />
<div class="form-floating mb-3">
<InputText @bind-Value="Input.RecoveryCode" class="form-control" autocomplete="off" placeholder="RecoveryCode" />
<label for="recovery-code" class="form-label">Recovery Code</label>
<InputText @bind-Value="Input.RecoveryCode" id="Input.RecoveryCode" class="form-control" autocomplete="off" placeholder="RecoveryCode" />
<label for="Input.RecoveryCode" class="form-label">Recovery Code</label>
<ValidationMessage For="() => Input.RecoveryCode" class="text-danger" />
</div>
<button type="submit" class="w-100 btn btn-lg btn-primary">Log in</button>

View File

@@ -2,7 +2,8 @@
@using System.ComponentModel.DataAnnotations
@using Microsoft.AspNetCore.Identity
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject UserManager<ApplicationUser> UserManager
@inject SignInManager<ApplicationUser> SignInManager
@@ -12,34 +13,32 @@
<PageTitle>Change password</PageTitle>
<MudText Typo="Typo.h6" GutterBottom="true">Change password</MudText>
<h3>Change password</h3>
<StatusMessage Message="@message" />
<EditForm Model="Input" FormName="change-password" OnValidSubmit="OnValidSubmitAsync" method="post">
<DataAnnotationsValidator />
<MudGrid>
<MudItem md="12">
<MudTextField For="@(() => Input.OldPassword)" @bind-Value="Input.OldPassword" InputType="InputType.Password"
Label="Old Password" Placeholder="old password" HelperText="Please enter your old password."
UserAttributes="@(new() { { "autocomplete", "current-password" }, { "aria-required", "true" } } )" />
</MudItem>
<MudItem md="12">
<MudTextField For="@(() => Input.NewPassword)" @bind-Value="Input.NewPassword" InputType="InputType.Password"
Label="New Password" Placeholder="new password" HelperText="Please enter your new password."
UserAttributes="@(new() { { "autocomplete", "new-password" }, { "aria-required", "true" } } )" />
</MudItem>
<MudItem md="12">
<MudTextField For="@(() => Input.ConfirmPassword)" @bind-Value="Input.ConfirmPassword" InputType="InputType.Password"
Label="Confirm Password" Placeholder="confirm password" HelperText="Please confirm your new password."
UserAttributes="@(new() { { "autocomplete", "new-password" }, { "aria-required", "true" } } )" />
</MudItem>
<MudItem md="12">
<MudButton Variant="Variant.Filled" Color="Color.Primary" FullWidth="true" FormAction="FormAction.Submit">Update password</MudButton>
</MudItem>
</MudGrid>
</EditForm>
<div class="row">
<div class="col-xl-6">
<EditForm Model="Input" FormName="change-password" OnValidSubmit="OnValidSubmitAsync" method="post">
<DataAnnotationsValidator />
<ValidationSummary class="text-danger" role="alert" />
<div class="form-floating mb-3">
<InputText type="password" @bind-Value="Input.OldPassword" id="Input.OldPassword" class="form-control" autocomplete="current-password" aria-required="true" placeholder="Enter the old password" />
<label for="Input.OldPassword" class="form-label">Old password</label>
<ValidationMessage For="() => Input.OldPassword" class="text-danger" />
</div>
<div class="form-floating mb-3">
<InputText type="password" @bind-Value="Input.NewPassword" id="Input.NewPassword" class="form-control" autocomplete="new-password" aria-required="true" placeholder="Enter the new password" />
<label for="Input.NewPassword" class="form-label">New password</label>
<ValidationMessage For="() => Input.NewPassword" class="text-danger" />
</div>
<div class="form-floating mb-3">
<InputText type="password" @bind-Value="Input.ConfirmPassword" id="Input.ConfirmPassword" class="form-control" autocomplete="new-password" aria-required="true" placeholder="Enter the new password" />
<label for="Input.ConfirmPassword" class="form-label">Confirm password</label>
<ValidationMessage For="() => Input.ConfirmPassword" class="text-danger" />
</div>
<button type="submit" class="w-100 btn btn-lg btn-primary">Update password</button>
</EditForm>
</div>
</div>
@code {
private string? message;

View File

@@ -2,7 +2,8 @@
@using System.ComponentModel.DataAnnotations
@using Microsoft.AspNetCore.Identity
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject UserManager<ApplicationUser> UserManager
@inject SignInManager<ApplicationUser> SignInManager
@@ -12,31 +13,31 @@
<PageTitle>Delete Personal Data</PageTitle>
<MudText Typo="Typo.h6" GutterBottom="true">Delete personal data</MudText>
<StatusMessage Message="@message" />
<MudAlert Severity="Severity.Error" Variant="Variant.Text">
Deleting this data will permanently remove your account, and this cannot be recovered.
</MudAlert>
<h3>Delete Personal Data</h3>
<EditForm Model="Input" FormName="delete-user" OnValidSubmit="OnValidSubmitAsync" method="post">
<DataAnnotationsValidator />
<div class="alert alert-warning" role="alert">
<p>
<strong>Deleting this data will permanently remove your account, and this cannot be recovered.</strong>
</p>
</div>
<MudGrid>
<div>
<EditForm Model="Input" FormName="delete-user" OnValidSubmit="OnValidSubmitAsync" method="post">
<DataAnnotationsValidator />
<ValidationSummary class="text-danger" role="alert" />
@if (requirePassword)
{
<MudItem md="12">
<MudTextField For="@(() => Input.Password)" @bind-Value="Input.Password" InputType="InputType.Password"
Label="Password" Placeholder="password" HelperText="Please enter your new password."
UserAttributes="@(new() { { "autocomplete", "current-password" }, { "aria-required", "true" } } )" />
</MudItem>
<div class="form-floating mb-3">
<InputText type="password" @bind-Value="Input.Password" id="Input.Password" class="form-control" autocomplete="current-password" aria-required="true" placeholder="Please enter your password." />
<label for="Input.Password" class="form-label">Password</label>
<ValidationMessage For="() => Input.Password" class="text-danger" />
</div>
}
<MudItem md="12">
<MudStaticButton Variant="Variant.Filled" Color="Color.Primary" FullWidth="true" FormAction="FormAction.Submit">Delete data and close my account</MudStaticButton>
</MudItem>
</MudGrid>
</EditForm>
<button class="w-100 btn btn-lg btn-danger" type="submit">Delete data and close my account</button>
</EditForm>
</div>
@code {
private string? message;

View File

@@ -1,7 +1,8 @@
@page "/Account/Manage/Disable2fa"
@using Microsoft.AspNetCore.Identity
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject UserManager<ApplicationUser> UserManager
@inject IdentityUserAccessor UserAccessor

View File

@@ -5,7 +5,8 @@
@using System.Text.Encodings.Web
@using Microsoft.AspNetCore.Identity
@using Microsoft.AspNetCore.WebUtilities
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject UserManager<ApplicationUser> UserManager
@inject IEmailSender<ApplicationUser> EmailSender
@@ -14,43 +15,44 @@
<PageTitle>Manage email</PageTitle>
<MudText Typo="Typo.h6" GutterBottom="true">Manage email</MudText>
<h3>Manage email</h3>
<StatusMessage Message="@message" />
<form @onsubmit="OnSendEmailVerificationAsync" @formname="send-verification" id="send-verification-form" method="post">
<AntiforgeryToken />
</form>
<EditForm Model="Input" FormName="change-email" OnValidSubmit="OnValidSubmitAsync" method="post">
<DataAnnotationsValidator />
<MudGrid>
@if (isEmailConfirmed)
{
<MudItem md="12">
<MudTextField Value="@email" Label="Email" Placeholder="Please enter your email." Disabled="true" AdornmentIcon="Icons.Material.Filled.Check" AdornmentColor="Color.Success" />
</MudItem>
}
else
{
<MudItem md="12">
<MudTextField Value="@email" Label="Email" Placeholder="Please enter your email." Disabled="true" />
</MudItem>
<MudItem md="12">
<MudButton Variant="Variant.Filled" Color="Color.Primary" FullWidth="true" FormAction="FormAction.Submit">Send verification email</MudButton>
</MudItem>
}
<MudItem md="12">
<MudTextField @bind-Value="@Input.NewEmail" For="@(() => Input.NewEmail)" UserAttributes="@(new() { { "autocomplete", "email" }, { "aria-required", "true" } } )" Label="New Email" HelperText="Please enter new email." />
</MudItem>
<MudItem md="12">
<MudButton Variant="Variant.Filled" Color="Color.Primary" FullWidth="true" FormAction="FormAction.Submit">Change email</MudButton>
</MudItem>
</MudGrid>
</EditForm>
<StatusMessage Message="@message"/>
<div class="row">
<div class="col-xl-6">
<form @onsubmit="OnSendEmailVerificationAsync" @formname="send-verification" id="send-verification-form" method="post">
<AntiforgeryToken />
</form>
<EditForm Model="Input" FormName="change-email" OnValidSubmit="OnValidSubmitAsync" method="post">
<DataAnnotationsValidator />
<ValidationSummary class="text-danger" role="alert" />
@if (isEmailConfirmed)
{
<div class="form-floating mb-3 input-group">
<input type="text" value="@email" id="email" class="form-control" placeholder="Enter your email" disabled />
<div class="input-group-append">
<span class="h-100 input-group-text text-success font-weight-bold">✓</span>
</div>
<label for="email" class="form-label">Email</label>
</div>
}
else
{
<div class="form-floating mb-3">
<input type="text" value="@email" id="email" class="form-control" placeholder="Enter your email" disabled />
<label for="email" class="form-label">Email</label>
<button type="submit" class="btn btn-link" form="send-verification-form">Send verification email</button>
</div>
}
<div class="form-floating mb-3">
<InputText @bind-Value="Input.NewEmail" id="Input.NewEmail" class="form-control" autocomplete="email" aria-required="true" placeholder="Enter a new email" />
<label for="Input.NewEmail" class="form-label">New email</label>
<ValidationMessage For="() => Input.NewEmail" class="text-danger" />
</div>
<button type="submit" class="w-100 btn btn-lg btn-primary">Change email</button>
</EditForm>
</div>
</div>
@code {
private string? message;

View File

@@ -5,7 +5,8 @@
@using System.Text
@using System.Text.Encodings.Web
@using Microsoft.AspNetCore.Identity
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject UserManager<ApplicationUser> UserManager
@inject IdentityUserAccessor UserAccessor
@@ -21,55 +22,49 @@
}
else
{
<MudText Typo="Typo.h6" GutterBottom="true">Configure authenticator app</MudText>
<StatusMessage Message="@message" />
<MudText Typo="Typo.body1" GutterBottom="true">To use an authenticator app go through the following steps:</MudText>
<ol class="list">
<li>
<MudText Typo="Typo.body2">
Download a two-factor authenticator app like Microsoft Authenticator for
<MudLink Target="_blank" Href="https://go.microsoft.com/fwlink/?Linkid=825072">Android</MudLink> and
<MudLink Target="_blank" Href="https://go.microsoft.com/fwlink/?Linkid=825073">iOS</MudLink> or
Google Authenticator for
<MudLink Target="_blank" Href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&amp;hl=en">Android</MudLink> and
<MudLink Target="_blank" Href="https://itunes.apple.com/us/app/google-authenticator/id388497605?mt=8">iOS</MudLink>.
</MudText>
</li>
<li>
<MudText Typo="Typo.body2">
Scan the QR Code or enter this key into your two factor authenticator app. Spaces and casing do not matter:
</MudText>
<MudAlert Variant="Variant.Text" Severity="Severity.Info" Icon="@Icons.Material.Filled.Key">@sharedKey</MudAlert>
<MudText Typo="Typo.body2">
Learn how to <MudLink Target="_blank" Href="https://go.microsoft.com/fwlink/?Linkid=852423">enable QR code generation</MudLink>.
</MudText>
<div data-url="@authenticatorUri"></div>
</li>
<li>
<MudText Typo="Typo.body2">
Once you have scanned the QR code or input the key above, your two factor authentication app will provide you
with a unique code. Enter the code in the confirmation box below.
</MudText>
<EditForm Model="Input" FormName="send-code" OnValidSubmit="OnValidSubmitAsync" method="post">
<DataAnnotationsValidator />
<MudGrid>
<MudItem md="12">
<MudTextField @bind-Value="@Input.Code" For="@(() => Input.Code)" Label="Verification Code" HelperText="Please enter the code." />
</MudItem>
<MudItem md="12">
<MudButton Variant="Variant.Filled" Color="Color.Primary" FullWidth="true" FormAction="FormAction.Submit">Verify</MudButton>
</MudItem>
</MudGrid>
</EditForm>
</li>
</ol>
<h3>Configure authenticator app</h3>
<div>
<p>To use an authenticator app go through the following steps:</p>
<ol class="list">
<li>
<p>
Download a two-factor authenticator app like Microsoft Authenticator for
<a href="https://go.microsoft.com/fwlink/?Linkid=825072">Android</a> and
<a href="https://go.microsoft.com/fwlink/?Linkid=825073">iOS</a> or
Google Authenticator for
<a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&amp;hl=en">Android</a> and
<a href="https://itunes.apple.com/us/app/google-authenticator/id388497605?mt=8">iOS</a>.
</p>
</li>
<li>
<p>Scan the QR Code or enter this key <kbd>@sharedKey</kbd> into your two factor authenticator app. Spaces and casing do not matter.</p>
<div class="alert alert-info">Learn how to <a href="https://go.microsoft.com/fwlink/?Linkid=852423">enable QR code generation</a>.</div>
<div></div>
<div data-url="@authenticatorUri"></div>
</li>
<li>
<p>
Once you have scanned the QR code or input the key above, your two factor authentication app will provide you
with a unique code. Enter the code in the confirmation box below.
</p>
<div class="row">
<div class="col-xl-6">
<EditForm Model="Input" FormName="send-code" OnValidSubmit="OnValidSubmitAsync" method="post">
<DataAnnotationsValidator />
<div class="form-floating mb-3">
<InputText @bind-Value="Input.Code" id="Input.Code" class="form-control" autocomplete="off" placeholder="Enter the code" />
<label for="Input.Code" class="control-label form-label">Verification Code</label>
<ValidationMessage For="() => Input.Code" class="text-danger" />
</div>
<button type="submit" class="w-100 btn btn-lg btn-primary">Verify</button>
<ValidationSummary class="text-danger" role="alert" />
</EditForm>
</div>
</div>
</li>
</ol>
</div>
}
@code {

View File

@@ -2,7 +2,8 @@
@using Microsoft.AspNetCore.Authentication
@using Microsoft.AspNetCore.Identity
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject UserManager<ApplicationUser> UserManager
@inject SignInManager<ApplicationUser> SignInManager
@@ -47,7 +48,7 @@
@if (otherLogins?.Count > 0)
{
<h4>Add another service to log in.</h4>
<MudDivider />
<hr />
<form class="form-horizontal" action="Account/Manage/LinkExternalLogin" method="post">
<AntiforgeryToken />
<div>

View File

@@ -1,7 +1,8 @@
@page "/Account/Manage/GenerateRecoveryCodes"
@using Microsoft.AspNetCore.Identity
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject UserManager<ApplicationUser> UserManager
@inject IdentityUserAccessor UserAccessor

View File

@@ -2,7 +2,8 @@
@using System.ComponentModel.DataAnnotations
@using Microsoft.AspNetCore.Identity
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject UserManager<ApplicationUser> UserManager
@inject SignInManager<ApplicationUser> SignInManager
@@ -11,27 +12,27 @@
<PageTitle>Profile</PageTitle>
<MudText Typo="Typo.h6" GutterBottom="true">Profile</MudText>
<h3>Profile</h3>
<StatusMessage />
<EditForm Model="Input" FormName="profile" OnValidSubmit="OnValidSubmitAsync" method="post">
<DataAnnotationsValidator />
<MudGrid>
<MudItem md="12">
<MudTextField Value="@username" Label="Username" Disabled="true" Placeholder="Please choose your username." />
</MudItem>
<MudItem md="12">
<MudTextField For="@(() => Input.PhoneNumber)" @bind-Value="Input.PhoneNumber"
Label="Phone Number" HelperText="Please enter your phone number."
UserAttributes="@(new() { { "autocomplete", "tel-national" } } )" />
</MudItem>
<MudItem md="12">
<MudButton Variant="Variant.Filled" Color="Color.Primary" FullWidth="true" FormAction="FormAction.Submit">Save</MudButton>
</MudItem>
</MudGrid>
</EditForm>
<div class="row">
<div class="col-xl-6">
<EditForm Model="Input" FormName="profile" OnValidSubmit="OnValidSubmitAsync" method="post">
<DataAnnotationsValidator />
<ValidationSummary class="text-danger" role="alert" />
<div class="form-floating mb-3">
<input type="text" value="@username" id="username" class="form-control" placeholder="Choose your username." disabled />
<label for="username" class="form-label">Username</label>
</div>
<div class="form-floating mb-3">
<InputText @bind-Value="Input.PhoneNumber" id="Input.PhoneNumber" class="form-control" placeholder="Enter your phone number" />
<label for="Input.PhoneNumber" class="form-label">Phone number</label>
<ValidationMessage For="() => Input.PhoneNumber" class="text-danger" />
</div>
<button type="submit" class="w-100 btn btn-lg btn-primary">Save</button>
</EditForm>
</div>
</div>
@code {
private ApplicationUser user = default!;

View File

@@ -1,34 +1,28 @@
@page "/Account/Manage/PersonalData"
@using MyAppName.WebApp.Components.Account
@inject IdentityUserAccessor UserAccessor
<PageTitle>Personal Data</PageTitle>
<MudText Typo="Typo.h6" GutterBottom="true">Personal data</MudText>
<StatusMessage />
<h3>Personal Data</h3>
<MudGrid>
<MudItem md="12">
<MudText Typo="Typo.body1">
Your account contains personal data that you have given us. This page allows you to download or delete that data.
</MudText>
</MudItem>
<MudItem md="12">
<MudAlert Severity="Severity.Warning" Variant="Variant.Text">
Deleting this data will permanently remove your account, and this cannot be recovered.
</MudAlert>
</MudItem>
<MudItem md="12">
<div class="row">
<div class="col-md-6">
<p>Your account contains personal data that you have given us. This page allows you to download or delete that data.</p>
<p>
<strong>Deleting this data will permanently remove your account, and this cannot be recovered.</strong>
</p>
<form action="Account/Manage/DownloadPersonalData" method="post">
<AntiforgeryToken />
<MudStaticButton Variant="Variant.Filled" Color="Color.Primary" FullWidth="true" FormAction="FormAction.Submit">Download</MudStaticButton>
<button class="btn btn-primary" type="submit">Download</button>
</form>
</MudItem>
<MudItem md="12">
<MudLink Href="Account/Manage/DeletePersonalData" Color="Color.Error">Delete</MudLink>
</MudItem>
</MudGrid>
<p>
<a href="Account/Manage/DeletePersonalData" class="btn btn-danger">Delete</a>
</p>
</div>
</div>
@code {
[CascadingParameter]

View File

@@ -1,7 +1,8 @@
@page "/Account/Manage/ResetAuthenticator"
@using Microsoft.AspNetCore.Identity
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject UserManager<ApplicationUser> UserManager
@inject SignInManager<ApplicationUser> SignInManager
@@ -11,24 +12,24 @@
<PageTitle>Reset authenticator key</PageTitle>
<MudText Typo="Typo.h6" GutterBottom="true">Reset authenticator key</MudText>
<StatusMessage />
<MudAlert Severity="Severity.Warning" Variant="Variant.Text">
If you reset your authenticator key your authenticator app will not work until you reconfigure it.
</MudAlert>
<MudText Typo="Typo.body2" Class="my-4">
This process disables 2FA until you verify your authenticator app.
If you do not complete your authenticator app configuration you may lose access to your account.
</MudText>
<form @formname="reset-authenticator" @onsubmit="OnSubmitAsync" method="post">
<AntiforgeryToken />
<MudStaticButton Variant="Variant.Filled" Color="Color.Primary" FullWidth="true" FormAction="FormAction.Submit">Reset authenticator key</MudStaticButton>
</form>
<h3>Reset authenticator key</h3>
<div class="alert alert-warning" role="alert">
<p>
<span class="glyphicon glyphicon-warning-sign"></span>
<strong>If you reset your authenticator key your authenticator app will not work until you reconfigure it.</strong>
</p>
<p>
This process disables 2FA until you verify your authenticator app.
If you do not complete your authenticator app configuration you may lose access to your account.
</p>
</div>
<div>
<form @formname="reset-authenticator" @onsubmit="OnSubmitAsync" method="post">
<AntiforgeryToken />
<button class="btn btn-danger" type="submit">Reset authenticator key</button>
</form>
</div>
@code {
[CascadingParameter]

View File

@@ -2,7 +2,8 @@
@using System.ComponentModel.DataAnnotations
@using Microsoft.AspNetCore.Identity
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject UserManager<ApplicationUser> UserManager
@inject SignInManager<ApplicationUser> SignInManager

View File

@@ -2,7 +2,8 @@
@using Microsoft.AspNetCore.Http.Features
@using Microsoft.AspNetCore.Identity
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject UserManager<ApplicationUser> UserManager
@inject SignInManager<ApplicationUser> SignInManager
@@ -11,72 +12,63 @@
<PageTitle>Two-factor authentication (2FA)</PageTitle>
<MudText Typo="Typo.h6" GutterBottom="true">Two-factor authentication (2FA)</MudText>
<StatusMessage />
<h3>Two-factor authentication (2FA)</h3>
@if (canTrack)
{
if (is2faEnabled)
{
if (recoveryCodesLeft == 0)
{
<MudAlert Variant="Variant.Text" Severity="Severity.Error">You have no recovery codes left.</MudAlert>
<MudText Typo="Typo.body1" Class="pt-4">
You must <MudLink Href="Account/Manage/GenerateRecoveryCodes">generate a new set of recovery codes</MudLink>
before you can log in with a recovery code.
</MudText>
<div class="alert alert-danger">
<strong>You have no recovery codes left.</strong>
<p>You must <a href="Account/Manage/GenerateRecoveryCodes">generate a new set of recovery codes</a> before you can log in with a recovery code.</p>
</div>
}
else if (recoveryCodesLeft == 1)
{
<MudAlert Variant="Variant.Text" Severity="Severity.Warning">You have 1 recovery code left.</MudAlert>
<MudText Typo="Typo.body1" Class="pt-4">
You can <MudLink Href="Account/Manage/GenerateRecoveryCodes">generate a new set of recovery codes</MudLink>.
</MudText>
<div class="alert alert-danger">
<strong>You have 1 recovery code left.</strong>
<p>You can <a href="Account/Manage/GenerateRecoveryCodes">generate a new set of recovery codes</a>.</p>
</div>
}
else if (recoveryCodesLeft <= 3)
{
<MudAlert Variant="Variant.Text" Severity="Severity.Warning">You have @recoveryCodesLeft recovery codes left.</MudAlert>
<MudText Typo="Typo.body1" Class="pt-4">
You should <MudLink Href="Account/Manage/GenerateRecoveryCodes">generate a new set of recovery codes</MudLink>.
</MudText>
<div class="alert alert-warning">
<strong>You have @recoveryCodesLeft recovery codes left.</strong>
<p>You should <a href="Account/Manage/GenerateRecoveryCodes">generate a new set of recovery codes</a>.</p>
</div>
}
if (isMachineRemembered)
{
<form style="display: inline-block" @formname="forget-browser" @onsubmit="OnSubmitForgetBrowserAsync" method="post">
<AntiforgeryToken />
<MudStaticButton Variant="Variant.Filled" Color="Color.Primary" FullWidth="true" FormAction="FormAction.Submit">Forget this browser</MudStaticButton>
<button type="submit" class="btn btn-primary">Forget this browser</button>
</form>
}
<MudLink Href="Account/Manage/Disable2fa">Disable 2FA</MudLink><br />
<MudLink Href="Account/Manage/GenerateRecoveryCodes">Reset recovery codes</MudLink>
<a href="Account/Manage/Disable2fa" class="btn btn-primary">Disable 2FA</a>
<a href="Account/Manage/GenerateRecoveryCodes" class="btn btn-primary">Reset recovery codes</a>
}
<MudText Typo="Typo.h6" GutterBottom="true">Authenticator app</MudText>
<h4>Authenticator app</h4>
@if (!hasAuthenticator)
{
<MudLink Href="Account/Manage/EnableAuthenticator">Add authenticator app</MudLink><br />
<a href="Account/Manage/EnableAuthenticator" class="btn btn-primary">Add authenticator app</a>
}
else
{
<MudLink Href="Account/Manage/EnableAuthenticator">Set up authenticator app</MudLink><br />
<MudLink Href="Account/Manage/ResetAuthenticator">Reset authenticator app</MudLink>
<a href="Account/Manage/EnableAuthenticator" class="btn btn-primary">Set up authenticator app</a>
<a href="Account/Manage/ResetAuthenticator" class="btn btn-primary">Reset authenticator app</a>
}
}
else
{
<MudAlert Variant="Variant.Text" Severity="Severity.Error">Privacy and cookie policy have not been accepted.</MudAlert>
<MudText Typo="Typo.body1" Class="pt-4">
You must accept the policy before you can enable two factor authentication.
</MudText>
<div class="alert alert-danger">
<strong>Privacy and cookie policy have not been accepted.</strong>
<p>You must accept the policy before you can enable two factor authentication.</p>
</div>
}
@code {

View File

@@ -1,2 +1,3 @@
@layout ManageLayout
@using OpenArchival.Blazor.Components.Account.Shared
@layout ManageLayout
@attribute [Microsoft.AspNetCore.Authorization.Authorize]

View File

@@ -5,7 +5,8 @@
@using System.Text.Encodings.Web
@using Microsoft.AspNetCore.Identity
@using Microsoft.AspNetCore.WebUtilities
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject UserManager<ApplicationUser> UserManager
@inject IUserStore<ApplicationUser> UserStore
@@ -17,43 +18,42 @@
<PageTitle>Register</PageTitle>
<MudText Typo="Typo.h3" GutterBottom="true">Register</MudText>
<h1>Register</h1>
<MudGrid>
<MudItem md="6">
<div class="row">
<div class="col-lg-6">
<StatusMessage Message="@Message" />
<EditForm Model="Input" asp-route-returnUrl="@ReturnUrl" method="post" OnValidSubmit="RegisterUser" FormName="register">
<DataAnnotationsValidator />
<MudText Typo="Typo.body1" GutterBottom="true">Create a new account.</MudText>
<MudGrid>
<MudItem md="12">
<MudTextField For="@(() => Input.Email)" @bind-Value="Input.Email"
Label="Email" Placeholder="name@example.com"
UserAttributes="@(new() { { "autocomplete", "username" }, { "aria-required", "true" } } )" />
</MudItem>
<MudItem md="12">
<MudTextField For="@(() => Input.Password)" @bind-Value="Input.Password"
Label="Password" InputType="InputType.Password" Placeholder="password"
UserAttributes="@(new() { { "autocomplete", "new-password" }, { "aria-required", "true" } } )" />
</MudItem>
<MudItem md="12">
<MudTextField For="@(() => Input.ConfirmPassword)" @bind-Value="Input.ConfirmPassword"
Label="Confirm Password" InputType="InputType.Password" Placeholder="confirm password"
UserAttributes="@(new() { { "autocomplete", "new-password" }, { "aria-required", "true" } } )" />
</MudItem>
<MudItem md="12">
<MudButton Variant="Variant.Filled" Color="Color.Primary" FullWidth="true" FormAction="FormAction.Submit">Register</MudButton>
</MudItem>
</MudGrid>
<h2>Create a new account.</h2>
<hr />
<ValidationSummary class="text-danger" role="alert" />
<div class="form-floating mb-3">
<InputText @bind-Value="Input.Email" id="Input.Email" class="form-control" autocomplete="username" aria-required="true" placeholder="name@example.com" />
<label for="Input.Email">Email</label>
<ValidationMessage For="() => Input.Email" class="text-danger" />
</div>
<div class="form-floating mb-3">
<InputText type="password" @bind-Value="Input.Password" id="Input.Password" class="form-control" autocomplete="new-password" aria-required="true" placeholder="password" />
<label for="Input.Password">Password</label>
<ValidationMessage For="() => Input.Password" class="text-danger" />
</div>
<div class="form-floating mb-3">
<InputText type="password" @bind-Value="Input.ConfirmPassword" id="Input.ConfirmPassword" class="form-control" autocomplete="new-password" aria-required="true" placeholder="password" />
<label for="Input.ConfirmPassword">Confirm Password</label>
<ValidationMessage For="() => Input.ConfirmPassword" class="text-danger" />
</div>
<button type="submit" class="w-100 btn btn-lg btn-primary">Register</button>
</EditForm>
</MudItem>
<MudItem md="6">
<MudText Typo="Typo.body1" GutterBottom="true">Use another service to register.</MudText>
<ExternalLoginPicker />
</MudItem>
</MudGrid>
</div>
<div class="col-lg-4 col-lg-offset-2">
<section>
<h3>Use another service to register.</h3>
<hr />
<ExternalLoginPicker />
</section>
</div>
</div>
@code {
private IEnumerable<IdentityError>? identityErrors;
@@ -73,8 +73,9 @@
await UserStore.SetUserNameAsync(user, Input.Email, CancellationToken.None);
var emailStore = GetEmailStore();
await emailStore.SetEmailAsync(user, Input.Email, CancellationToken.None);
var result = await UserManager.CreateAsync(user, Input.Password);
await UserManager.AddToRoleAsync(user, "User");
var result = await UserManager.CreateAsync(user, Input.Password);
if (!result.Succeeded)
{
identityErrors = result.Errors;
@@ -103,7 +104,7 @@
RedirectManager.RedirectTo(ReturnUrl);
}
private static ApplicationUser CreateUser()
private ApplicationUser CreateUser()
{
try
{

View File

@@ -3,7 +3,8 @@
@using System.Text
@using Microsoft.AspNetCore.Identity
@using Microsoft.AspNetCore.WebUtilities
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject UserManager<ApplicationUser> UserManager
@inject IEmailSender<ApplicationUser> EmailSender
@@ -19,8 +20,8 @@
@if (emailConfirmationLink is not null)
{
<p>
This app does not currently have a real email sender registered, see <a class="mud-link mud-primary-text mud-link-underline-hover" href="https://aka.ms/aspaccountconf">these docs</a> for how to configure a real email sender.
Normally this would be emailed: <a class="mud-link mud-primary-text mud-link-underline-hover" href="@emailConfirmationLink">Click here to confirm your account</a>
This app does not currently have a real email sender registered, see <a href="https://aka.ms/aspaccountconf">these docs</a> for how to configure a real email sender.
Normally this would be emailed: <a href="@emailConfirmationLink">Click here to confirm your account</a>
</p>
}
else

View File

@@ -5,7 +5,8 @@
@using System.Text.Encodings.Web
@using Microsoft.AspNetCore.Identity
@using Microsoft.AspNetCore.WebUtilities
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject UserManager<ApplicationUser> UserManager
@inject IEmailSender<ApplicationUser> EmailSender
@@ -14,26 +15,24 @@
<PageTitle>Resend email confirmation</PageTitle>
<MudText Typo="Typo.h3" GutterBottom="true">Resend email confirmation</MudText>
<MudText Typo="Typo.body1" GutterBottom="true">Enter your email.</MudText>
<h1>Resend email confirmation</h1>
<h2>Enter your email.</h2>
<hr />
<StatusMessage Message="@message" />
<EditForm Model="Input" FormName="resend-email-confirmation" OnValidSubmit="OnValidSubmitAsync" method="post">
<DataAnnotationsValidator />
<MudGrid>
<MudItem md="12">
<MudTextField For="@(() => Input.Email)" @bind-Value="Input.Email"
Label="Email" Placeholder="name@example.com"
UserAttributes="@(new() { { "autocomplete", "username" }, { "aria-required", "true" } } )" />
</MudItem>
<MudItem md="12">
<MudButton Variant="Variant.Filled" Color="Color.Primary" FullWidth="true" FormAction="FormAction.Submit">Resend</MudButton>
</MudItem>
</MudGrid>
</EditForm>
<div class="row">
<div class="col-md-4">
<EditForm Model="Input" FormName="resend-email-confirmation" OnValidSubmit="OnValidSubmitAsync" method="post">
<DataAnnotationsValidator />
<ValidationSummary class="text-danger" role="alert" />
<div class="form-floating mb-3">
<InputText @bind-Value="Input.Email" id="Input.Email" class="form-control" aria-required="true" placeholder="name@example.com" />
<label for="Input.Email" class="form-label">Email</label>
<ValidationMessage For="() => Input.Email" class="text-danger" />
</div>
<button type="submit" class="w-100 btn btn-lg btn-primary">Resend</button>
</EditForm>
</div>
</div>
@code {
private string? message;

View File

@@ -4,7 +4,8 @@
@using System.Text
@using Microsoft.AspNetCore.Identity
@using Microsoft.AspNetCore.WebUtilities
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject IdentityRedirectManager RedirectManager
@inject UserManager<ApplicationUser> UserManager
@@ -13,7 +14,7 @@
<h1>Reset password</h1>
<h2>Reset your password.</h2>
<MudDivider />
<hr />
<div class="row">
<div class="col-md-4">
<StatusMessage Message="@Message" />

View File

@@ -3,5 +3,5 @@
<h1>Reset password confirmation</h1>
<p role="alert">
Your password has been reset. Please <a class="mud-link mud-primary-text mud-link-underline-hover" href="Account/Login">click here to log in</a>.
Your password has been reset. Please <a href="Account/Login">click here to log in</a>.
</p>

View File

@@ -1,3 +1,2 @@
@using MudBlazor
@using OpenArchival.Blazor.Components.Account.Shared
@using OpenArchival.Blazor.Components.Account.Shared
@attribute [ExcludeFromInteractiveRouting]

View File

@@ -1,18 +1,19 @@
@using Microsoft.AspNetCore.Authentication
@using Microsoft.AspNetCore.Identity
@using MudBlazor
@using OpenArchival.Blazor.Data
@using MyAppName.WebApp.Components.Account
@using OpenArchival.DataAccess
@inject SignInManager<ApplicationUser> SignInManager
@inject IdentityRedirectManager RedirectManager
@if (externalLogins.Length == 0)
{
<MudAlert Variant="Variant.Text" Severity="Severity.Warning">There are no external authentication services configured.</MudAlert>
<MudText Typo="Typo.body1" Class="pt-4">
See <MudLink Target="_blank" Href="https://go.microsoft.com/fwlink/?LinkID=532715">this article</MudLink>
about setting up this ASP.NET application to support logging in via external services
</MudText>
<div>
<p>
There are no external authentication services configured. See this <a href="https://go.microsoft.com/fwlink/?LinkID=532715">article
about setting up this ASP.NET application to support logging in via external services</a>.
</p>
</div>
}
else
{

View File

@@ -1,14 +1,18 @@
@inherits LayoutComponentBase
@layout OpenArchival.Blazor.Components.Layout.MainLayout
@using OpenArchival.Blazor.Components.Layout
@inherits LayoutComponentBase
@layout MainLayout
<MudText Typo="Typo.h3" GutterBottom="true">Manage your account</MudText>
<h1>Manage your account</h1>
<MudGrid>
<MudItem md="5">
<MudText Typo="Typo.h6" GutterBottom="true">Change your account settings</MudText>
<ManageNavMenu />
</MudItem>
<MudItem md="7">
@Body
</MudItem>
</MudGrid>
<div>
<h2>Change your account settings</h2>
<hr />
<div class="row">
<div class="col-lg-3">
<ManageNavMenu />
</div>
<div class="col-lg-9">
@Body
</div>
</div>
</div>

View File

@@ -1,19 +1,31 @@
@using Microsoft.AspNetCore.Identity
@using OpenArchival.Blazor.Data
@using OpenArchival.DataAccess
@inject SignInManager<ApplicationUser> SignInManager
<MudNavMenu>
<MudNavLink Href="Account/Manage" Match="NavLinkMatch.All" Icon="@Icons.Material.Filled.Person">Profile</MudNavLink>
<MudNavLink Href="Account/Manage/Email" Icon="@Icons.Material.Filled.Email">Email</MudNavLink>
<MudNavLink Href="Account/Manage/ChangePassword" Icon="@Icons.Material.Filled.Lock">Password</MudNavLink>
<ul class="nav nav-pills flex-column">
<li class="nav-item">
<NavLink class="nav-link" href="Account/Manage" Match="NavLinkMatch.All">Profile</NavLink>
</li>
<li class="nav-item">
<NavLink class="nav-link" href="Account/Manage/Email">Email</NavLink>
</li>
<li class="nav-item">
<NavLink class="nav-link" href="Account/Manage/ChangePassword">Password</NavLink>
</li>
@if (hasExternalLogins)
{
<MudNavLink Href="Account/Manage/ExternalLogins" Icon="@Icons.Material.Filled.PhoneLocked">External logins</MudNavLink>
<li class="nav-item">
<NavLink class="nav-link" href="Account/Manage/ExternalLogins">External logins</NavLink>
</li>
}
<MudNavLink Href="Account/Manage/TwoFactorAuthentication" Icon="@Icons.Material.Filled.LockClock">Two-factor authentication</MudNavLink>
<MudNavLink Href="Account/Manage/PersonalData" Icon="@Icons.Material.Filled.PersonRemove">Personal data</MudNavLink>
</MudNavMenu>
<li class="nav-item">
<NavLink class="nav-link" href="Account/Manage/TwoFactorAuthentication">Two-factor authentication</NavLink>
</li>
<li class="nav-item">
<NavLink class="nav-link" href="Account/Manage/PersonalData">Personal data</NavLink>
</li>
</ul>
@code {
private bool hasExternalLogins;

View File

@@ -1,8 +1,10 @@
@if (!string.IsNullOrEmpty(DisplayMessage))
@using MyAppName.WebApp.Components.Account
@if (!string.IsNullOrEmpty(DisplayMessage))
{
var severity = DisplayMessage.StartsWith("Error") ? Severity.Error : Severity.Success;
<MudAlert Variant="Variant.Outlined" Severity="@severity">@DisplayMessage</MudAlert>
var statusMessageClass = DisplayMessage.StartsWith("Error") ? "danger" : "success";
<div class="alert alert-@statusMessageClass" role="alert">
@DisplayMessage
</div>
}
@code {