Reformat new server project.

This commit is contained in:
2024-05-03 03:24:40 +01:00
parent a85ca9efc6
commit be385713c2
46 changed files with 419 additions and 458 deletions

View File

@@ -1,21 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-Aaru.Server.New-79282495-4F67-4766-871D-448D1338E8BC</UserSecretsId> <UserSecretsId>aspnet-Aaru.Server.New-79282495-4F67-4766-871D-448D1338E8BC</UserSecretsId>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Update="Data\app.db" CopyToOutputDirectory="PreserveNewest" ExcludeFromSingleFile="true"/> <None Update="Data\app.db" CopyToOutputDirectory="PreserveNewest" ExcludeFromSingleFile="true"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.4"/> <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.4"/>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.4"/> <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.4"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.4"/> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.4"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.4"/> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.4"/>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -1,25 +1,26 @@
using System.Reflection;
using System.Security.Claims; using System.Security.Claims;
using System.Text.Json; using System.Text.Json;
using Aaru.Server.New.Components.Account.Pages;
using Aaru.Server.New.Components.Account.Pages.Manage;
using Aaru.Server.New.Data;
using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Components.Authorization; using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives; using Microsoft.Extensions.Primitives;
using Aaru.Server.New.Components.Account.Pages;
using Aaru.Server.New.Components.Account.Pages.Manage;
using Aaru.Server.New.Data;
namespace Microsoft.AspNetCore.Routing; namespace Microsoft.AspNetCore.Routing;
internal static class IdentityComponentsEndpointRouteBuilderExtensions static class IdentityComponentsEndpointRouteBuilderExtensions
{ {
// These endpoints are required by the Identity Razor components defined in the /Components/Account/Pages directory of this project. // These endpoints are required by the Identity Razor components defined in the /Components/Account/Pages directory of this project.
public static IEndpointConventionBuilder MapAdditionalIdentityEndpoints(this IEndpointRouteBuilder endpoints) public static IEndpointConventionBuilder MapAdditionalIdentityEndpoints(this IEndpointRouteBuilder endpoints)
{ {
ArgumentNullException.ThrowIfNull(endpoints); ArgumentNullException.ThrowIfNull(endpoints);
var accountGroup = endpoints.MapGroup("/Account"); RouteGroupBuilder accountGroup = endpoints.MapGroup("/Account");
accountGroup.MapPost("/PerformExternalLogin", accountGroup.MapPost("/PerformExternalLogin",
(HttpContext context, [FromServices] SignInManager<ApplicationUser> signInManager, (HttpContext context, [FromServices] SignInManager<ApplicationUser> signInManager,
@@ -27,14 +28,16 @@ internal static class IdentityComponentsEndpointRouteBuilderExtensions
{ {
IEnumerable<KeyValuePair<string, StringValues>> query = IEnumerable<KeyValuePair<string, StringValues>> query =
[ [
new("ReturnUrl", returnUrl), new("Action", ExternalLogin.LoginCallbackAction) new KeyValuePair<string, StringValues>("ReturnUrl", returnUrl),
new KeyValuePair<string, StringValues>("Action",
ExternalLogin.LoginCallbackAction)
]; ];
var redirectUrl = UriHelper.BuildRelative(context.Request.PathBase, string redirectUrl = UriHelper.BuildRelative(context.Request.PathBase,
"/Account/ExternalLogin", "/Account/ExternalLogin",
QueryString.Create(query)); QueryString.Create(query));
var properties = AuthenticationProperties properties =
signInManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl); signInManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl);
return TypedResults.Challenge(properties, [provider]); return TypedResults.Challenge(properties, [provider]);
@@ -49,7 +52,7 @@ internal static class IdentityComponentsEndpointRouteBuilderExtensions
return TypedResults.LocalRedirect($"~/{returnUrl}"); return TypedResults.LocalRedirect($"~/{returnUrl}");
}); });
var manageGroup = accountGroup.MapGroup("/Manage").RequireAuthorization(); RouteGroupBuilder manageGroup = accountGroup.MapGroup("/Manage").RequireAuthorization();
manageGroup.MapPost("/LinkExternalLogin", manageGroup.MapPost("/LinkExternalLogin",
async (HttpContext context, [FromServices] SignInManager<ApplicationUser> signInManager, async (HttpContext context, [FromServices] SignInManager<ApplicationUser> signInManager,
@@ -58,13 +61,13 @@ internal static class IdentityComponentsEndpointRouteBuilderExtensions
// Clear the existing external cookie to ensure a clean login process // Clear the existing external cookie to ensure a clean login process
await context.SignOutAsync(IdentityConstants.ExternalScheme); await context.SignOutAsync(IdentityConstants.ExternalScheme);
var redirectUrl = UriHelper.BuildRelative(context.Request.PathBase, string redirectUrl = UriHelper.BuildRelative(context.Request.PathBase,
"/Account/Manage/ExternalLogins", "/Account/Manage/ExternalLogins",
QueryString.Create("Action", QueryString.Create("Action",
ExternalLogins ExternalLogins
.LinkLoginCallbackAction)); .LinkLoginCallbackAction));
var properties = AuthenticationProperties properties =
signInManager.ConfigureExternalAuthenticationProperties(provider, signInManager.ConfigureExternalAuthenticationProperties(provider,
redirectUrl, redirectUrl,
signInManager.UserManager.GetUserId(context.User)); signInManager.UserManager.GetUserId(context.User));
@@ -72,14 +75,14 @@ internal static class IdentityComponentsEndpointRouteBuilderExtensions
return TypedResults.Challenge(properties, [provider]); return TypedResults.Challenge(properties, [provider]);
}); });
var loggerFactory = endpoints.ServiceProvider.GetRequiredService<ILoggerFactory>(); ILoggerFactory loggerFactory = endpoints.ServiceProvider.GetRequiredService<ILoggerFactory>();
var downloadLogger = loggerFactory.CreateLogger("DownloadPersonalData"); ILogger downloadLogger = loggerFactory.CreateLogger("DownloadPersonalData");
manageGroup.MapPost("/DownloadPersonalData", manageGroup.MapPost("/DownloadPersonalData",
async (HttpContext context, [FromServices] UserManager<ApplicationUser> userManager, async (HttpContext context, [FromServices] UserManager<ApplicationUser> userManager,
[FromServices] AuthenticationStateProvider authenticationStateProvider) => [FromServices] AuthenticationStateProvider authenticationStateProvider) =>
{ {
var user = await userManager.GetUserAsync(context.User); ApplicationUser? user = await userManager.GetUserAsync(context.User);
if(user is null) if(user is null)
{ {
@@ -88,7 +91,7 @@ internal static class IdentityComponentsEndpointRouteBuilderExtensions
.NotFound($"Unable to load user with ID '{userManager.GetUserId(context.User)}'."); .NotFound($"Unable to load user with ID '{userManager.GetUserId(context.User)}'.");
} }
var userId = await userManager.GetUserIdAsync(user); string userId = await userManager.GetUserIdAsync(user);
downloadLogger.LogInformation("User with ID '{UserId}' asked for their personal data.", downloadLogger.LogInformation("User with ID '{UserId}' asked for their personal data.",
userId); userId);
@@ -96,32 +99,26 @@ internal static class IdentityComponentsEndpointRouteBuilderExtensions
// Only include personal data for download // Only include personal data for download
var personalData = new Dictionary<string, string>(); var personalData = new Dictionary<string, string>();
var personalDataProps = typeof(ApplicationUser).GetProperties() IEnumerable<PropertyInfo> personalDataProps = typeof(ApplicationUser).GetProperties()
.Where(prop => Attribute.IsDefined(prop, typeof(PersonalDataAttribute))); .Where(prop => Attribute.IsDefined(prop, typeof(PersonalDataAttribute)));
foreach(var p in personalDataProps) foreach(PropertyInfo p in personalDataProps)
{
personalData.Add(p.Name, p.GetValue(user)?.ToString() ?? "null"); personalData.Add(p.Name, p.GetValue(user)?.ToString() ?? "null");
}
var logins = await userManager.GetLoginsAsync(user); IList<UserLoginInfo> logins = await userManager.GetLoginsAsync(user);
foreach(var l in logins) foreach(UserLoginInfo l in logins)
{
personalData.Add($"{l.LoginProvider} external login provider key", l.ProviderKey); personalData.Add($"{l.LoginProvider} external login provider key", l.ProviderKey);
}
personalData.Add("Authenticator Key", personalData.Add("Authenticator Key",
(await userManager.GetAuthenticatorKeyAsync(user))!); (await userManager.GetAuthenticatorKeyAsync(user))!);
var fileBytes = JsonSerializer.SerializeToUtf8Bytes(personalData); byte[] fileBytes = JsonSerializer.SerializeToUtf8Bytes(personalData);
context.Response.Headers.TryAdd("Content-Disposition", context.Response.Headers.TryAdd("Content-Disposition",
"attachment; filename=PersonalData.json"); "attachment; filename=PersonalData.json");
return TypedResults.File(fileBytes, return TypedResults.File(fileBytes, "application/json", "PersonalData.json");
contentType: "application/json",
fileDownloadName: "PersonalData.json");
}); });
return accountGroup; return accountGroup;

View File

@@ -1,13 +1,13 @@
using Aaru.Server.New.Data;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Identity.UI.Services;
using Aaru.Server.New.Data;
namespace Aaru.Server.New.Components.Account; namespace Aaru.Server.New.Components.Account;
// Remove the "else if (EmailSender is IdentityNoOpEmailSender)" block from RegisterConfirmation.razor after updating with a real implementation. // Remove the "else if (EmailSender is IdentityNoOpEmailSender)" block from RegisterConfirmation.razor after updating with a real implementation.
internal sealed class IdentityNoOpEmailSender : IEmailSender<ApplicationUser> sealed class IdentityNoOpEmailSender : IEmailSender<ApplicationUser>
{ {
private readonly IEmailSender emailSender = new NoOpEmailSender(); readonly IEmailSender emailSender = new NoOpEmailSender();
public Task SendConfirmationLinkAsync(ApplicationUser user, string email, string confirmationLink) => public Task SendConfirmationLinkAsync(ApplicationUser user, string email, string confirmationLink) =>
emailSender.SendEmailAsync(email, emailSender.SendEmailAsync(email,

View File

@@ -3,28 +3,27 @@ using Microsoft.AspNetCore.Components;
namespace Aaru.Server.New.Components.Account; namespace Aaru.Server.New.Components.Account;
internal sealed class IdentityRedirectManager(NavigationManager navigationManager) sealed class IdentityRedirectManager(NavigationManager navigationManager)
{ {
public const string StatusCookieName = "Identity.StatusMessage"; public const string StatusCookieName = "Identity.StatusMessage";
private static readonly CookieBuilder StatusCookieBuilder = new() static readonly CookieBuilder StatusCookieBuilder = new()
{ {
SameSite = SameSiteMode.Strict, SameSite = SameSiteMode.Strict,
HttpOnly = true, HttpOnly = true,
IsEssential = true, IsEssential = true,
MaxAge = TimeSpan.FromSeconds(5), MaxAge = TimeSpan.FromSeconds(5)
}; };
string CurrentPath => navigationManager.ToAbsoluteUri(navigationManager.Uri).GetLeftPart(UriPartial.Path);
[DoesNotReturn] [DoesNotReturn]
public void RedirectTo(string? uri) public void RedirectTo(string? uri)
{ {
uri ??= ""; uri ??= "";
// Prevent open redirects. // Prevent open redirects.
if(!Uri.IsWellFormedUriString(uri, UriKind.Relative)) if(!Uri.IsWellFormedUriString(uri, UriKind.Relative)) uri = navigationManager.ToBaseRelativePath(uri);
{
uri = navigationManager.ToBaseRelativePath(uri);
}
// During static rendering, NavigateTo throws a NavigationException which is handled by the framework as a redirect. // During static rendering, NavigateTo throws a NavigationException which is handled by the framework as a redirect.
// So as long as this is called from a statically rendered Identity component, the InvalidOperationException is never thrown. // So as long as this is called from a statically rendered Identity component, the InvalidOperationException is never thrown.
@@ -37,8 +36,8 @@ internal sealed class IdentityRedirectManager(NavigationManager navigationManage
[DoesNotReturn] [DoesNotReturn]
public void RedirectTo(string uri, Dictionary<string, object?> queryParameters) public void RedirectTo(string uri, Dictionary<string, object?> queryParameters)
{ {
var uriWithoutQuery = navigationManager.ToAbsoluteUri(uri).GetLeftPart(UriPartial.Path); string uriWithoutQuery = navigationManager.ToAbsoluteUri(uri).GetLeftPart(UriPartial.Path);
var newUri = navigationManager.GetUriWithQueryParameters(uriWithoutQuery, queryParameters); string newUri = navigationManager.GetUriWithQueryParameters(uriWithoutQuery, queryParameters);
RedirectTo(newUri); RedirectTo(newUri);
} }
@@ -49,8 +48,6 @@ internal sealed class IdentityRedirectManager(NavigationManager navigationManage
RedirectTo(uri); RedirectTo(uri);
} }
private string CurrentPath => navigationManager.ToAbsoluteUri(navigationManager.Uri).GetLeftPart(UriPartial.Path);
[DoesNotReturn] [DoesNotReturn]
public void RedirectToCurrentPage() => RedirectTo(CurrentPath); public void RedirectToCurrentPage() => RedirectTo(CurrentPath);

View File

@@ -1,15 +1,15 @@
using System.Security.Claims; using System.Security.Claims;
using Aaru.Server.New.Data;
using Microsoft.AspNetCore.Components.Authorization; using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Server; using Microsoft.AspNetCore.Components.Server;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Aaru.Server.New.Data;
namespace Aaru.Server.New.Components.Account; namespace Aaru.Server.New.Components.Account;
// This is a server-side AuthenticationStateProvider that revalidates the security stamp for the connected user // This is a server-side AuthenticationStateProvider that revalidates the security stamp for the connected user
// every 30 minutes an interactive circuit is connected. // every 30 minutes an interactive circuit is connected.
internal sealed class IdentityRevalidatingAuthenticationStateProvider sealed class IdentityRevalidatingAuthenticationStateProvider
(ILoggerFactory loggerFactory, IServiceScopeFactory scopeFactory, IOptions<IdentityOptions> options) (ILoggerFactory loggerFactory, IServiceScopeFactory scopeFactory, IOptions<IdentityOptions> options)
: RevalidatingServerAuthenticationStateProvider(loggerFactory) : RevalidatingServerAuthenticationStateProvider(loggerFactory)
{ {
@@ -19,31 +19,25 @@ internal sealed class IdentityRevalidatingAuthenticationStateProvider
AuthenticationState authenticationState, CancellationToken cancellationToken) AuthenticationState authenticationState, CancellationToken cancellationToken)
{ {
// Get the user manager from a new scope to ensure it fetches fresh data // Get the user manager from a new scope to ensure it fetches fresh data
await using var scope = scopeFactory.CreateAsyncScope(); await using AsyncServiceScope scope = scopeFactory.CreateAsyncScope();
var userManager = scope.ServiceProvider.GetRequiredService<UserManager<ApplicationUser>>();
UserManager<ApplicationUser> userManager =
scope.ServiceProvider.GetRequiredService<UserManager<ApplicationUser>>();
return await ValidateSecurityStampAsync(userManager, authenticationState.User); return await ValidateSecurityStampAsync(userManager, authenticationState.User);
} }
private async Task<bool> ValidateSecurityStampAsync(UserManager<ApplicationUser> userManager, async Task<bool> ValidateSecurityStampAsync(UserManager<ApplicationUser> userManager, ClaimsPrincipal principal)
ClaimsPrincipal principal)
{ {
var user = await userManager.GetUserAsync(principal); ApplicationUser? user = await userManager.GetUserAsync(principal);
if(user is null) if(user is null) return false;
{
return false;
}
else if(!userManager.SupportsUserSecurityStamp)
{
return true;
}
else
{
var principalStamp = principal.FindFirstValue(options.Value.ClaimsIdentity.SecurityStampClaimType);
var userStamp = await userManager.GetSecurityStampAsync(user);
return principalStamp == userStamp; if(!userManager.SupportsUserSecurityStamp) return true;
}
string? principalStamp = principal.FindFirstValue(options.Value.ClaimsIdentity.SecurityStampClaimType);
string userStamp = await userManager.GetSecurityStampAsync(user);
return principalStamp == userStamp;
} }
} }

View File

@@ -1,14 +1,13 @@
using Microsoft.AspNetCore.Identity;
using Aaru.Server.New.Data; using Aaru.Server.New.Data;
using Microsoft.AspNetCore.Identity;
namespace Aaru.Server.New.Components.Account; namespace Aaru.Server.New.Components.Account;
internal sealed class IdentityUserAccessor sealed class IdentityUserAccessor(UserManager<ApplicationUser> userManager, IdentityRedirectManager redirectManager)
(UserManager<ApplicationUser> userManager, IdentityRedirectManager redirectManager)
{ {
public async Task<ApplicationUser> GetRequiredUserAsync(HttpContext context) public async Task<ApplicationUser> GetRequiredUserAsync(HttpContext context)
{ {
var user = await userManager.GetUserAsync(context.User); ApplicationUser? user = await userManager.GetUserAsync(context.User);
if(user is null) if(user is null)
{ {

View File

@@ -1,9 +1,8 @@
@page "/Account/ConfirmEmail" @page "/Account/ConfirmEmail"
@using System.Text @using System.Text
@using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Identity @using Microsoft.AspNetCore.Identity
@using Microsoft.AspNetCore.WebUtilities @using Microsoft.AspNetCore.WebUtilities
@using Aaru.Server.New.Data
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject IdentityRedirectManager RedirectManager @inject IdentityRedirectManager RedirectManager
@@ -32,7 +31,7 @@
RedirectManager.RedirectTo(""); RedirectManager.RedirectTo("");
} }
var user = await UserManager.FindByIdAsync(UserId); ApplicationUser? user = await UserManager.FindByIdAsync(UserId);
if(user is null) if(user is null)
{ {
@@ -41,8 +40,8 @@
} }
else else
{ {
var code = Encoding.UTF8.GetString(WebEncoders.Base64UrlDecode(Code)); string code = Encoding.UTF8.GetString(WebEncoders.Base64UrlDecode(Code));
var result = await UserManager.ConfirmEmailAsync(user, code); IdentityResult result = await UserManager.ConfirmEmailAsync(user, code);
statusMessage = result.Succeeded ? "Thank you for confirming your email." : "Error confirming your email."; statusMessage = result.Succeeded ? "Thank you for confirming your email." : "Error confirming your email.";
} }
} }

View File

@@ -1,9 +1,8 @@
@page "/Account/ConfirmEmailChange" @page "/Account/ConfirmEmailChange"
@using System.Text @using System.Text
@using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Identity @using Microsoft.AspNetCore.Identity
@using Microsoft.AspNetCore.WebUtilities @using Microsoft.AspNetCore.WebUtilities
@using Aaru.Server.New.Data
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject SignInManager<ApplicationUser> SignInManager @inject SignInManager<ApplicationUser> SignInManager
@@ -37,7 +36,7 @@
RedirectManager.RedirectToWithStatus("Account/Login", "Error: Invalid email change confirmation link.", HttpContext); RedirectManager.RedirectToWithStatus("Account/Login", "Error: Invalid email change confirmation link.", HttpContext);
} }
var user = await UserManager.FindByIdAsync(UserId); ApplicationUser? user = await UserManager.FindByIdAsync(UserId);
if(user is null) if(user is null)
{ {
@@ -46,8 +45,8 @@
return; return;
} }
var code = Encoding.UTF8.GetString(WebEncoders.Base64UrlDecode(Code)); string code = Encoding.UTF8.GetString(WebEncoders.Base64UrlDecode(Code));
var result = await UserManager.ChangeEmailAsync(user, Email, code); IdentityResult result = await UserManager.ChangeEmailAsync(user, Email, code);
if(!result.Succeeded) if(!result.Succeeded)
{ {
@@ -58,7 +57,7 @@
// In our UI email and user name are one and the same, so when we update the email // In our UI email and user name are one and the same, so when we update the email
// we need to update the user name. // we need to update the user name.
var setUserNameResult = await UserManager.SetUserNameAsync(user, Email); IdentityResult setUserNameResult = await UserManager.SetUserNameAsync(user, Email);
if(!setUserNameResult.Succeeded) if(!setUserNameResult.Succeeded)
{ {

View File

@@ -1,12 +1,11 @@
@page "/Account/ExternalLogin" @page "/Account/ExternalLogin"
@using System.ComponentModel.DataAnnotations @using System.ComponentModel.DataAnnotations
@using System.Security.Claims @using System.Security.Claims
@using System.Text @using System.Text
@using System.Text.Encodings.Web @using System.Text.Encodings.Web
@using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Identity @using Microsoft.AspNetCore.Identity
@using Microsoft.AspNetCore.WebUtilities @using Microsoft.AspNetCore.WebUtilities
@using Aaru.Server.New.Data
@inject SignInManager<ApplicationUser> SignInManager @inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@@ -74,7 +73,7 @@
RedirectManager.RedirectToWithStatus("Account/Login", $"Error from external provider: {RemoteError}", HttpContext); RedirectManager.RedirectToWithStatus("Account/Login", $"Error from external provider: {RemoteError}", HttpContext);
} }
var info = await SignInManager.GetExternalLoginInfoAsync(); ExternalLoginInfo? info = await SignInManager.GetExternalLoginInfoAsync();
if(info is null) if(info is null)
{ {
@@ -101,7 +100,7 @@
private async Task OnLoginCallbackAsync() private async Task OnLoginCallbackAsync()
{ {
// Sign in the user with this external login provider if the user already has a login. // 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, isPersistent: false, bypassTwoFactor: true); SignInResult result = await SignInManager.ExternalLoginSignInAsync(externalLoginInfo.LoginProvider, externalLoginInfo.ProviderKey, false, true);
if(result.Succeeded) if(result.Succeeded)
{ {
@@ -122,13 +121,13 @@
private async Task OnValidSubmitAsync() private async Task OnValidSubmitAsync()
{ {
var emailStore = GetEmailStore(); IUserEmailStore<ApplicationUser> emailStore = GetEmailStore();
var user = CreateUser(); ApplicationUser user = CreateUser();
await UserStore.SetUserNameAsync(user, Input.Email, CancellationToken.None); await UserStore.SetUserNameAsync(user, Input.Email, CancellationToken.None);
await emailStore.SetEmailAsync(user, Input.Email, CancellationToken.None); await emailStore.SetEmailAsync(user, Input.Email, CancellationToken.None);
var result = await UserManager.CreateAsync(user); IdentityResult result = await UserManager.CreateAsync(user);
if(result.Succeeded) if(result.Succeeded)
{ {
@@ -138,16 +137,16 @@
{ {
Logger.LogInformation("User created an account using {Name} provider.", externalLoginInfo.LoginProvider); Logger.LogInformation("User created an account using {Name} provider.", externalLoginInfo.LoginProvider);
var userId = await UserManager.GetUserIdAsync(user); string userId = await UserManager.GetUserIdAsync(user);
var code = await UserManager.GenerateEmailConfirmationTokenAsync(user); string code = await UserManager.GenerateEmailConfirmationTokenAsync(user);
code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code)); code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
var callbackUrl = NavigationManager.GetUriWithQueryParameters(NavigationManager.ToAbsoluteUri("Account/ConfirmEmail").AbsoluteUri, string callbackUrl = NavigationManager.GetUriWithQueryParameters(NavigationManager.ToAbsoluteUri("Account/ConfirmEmail").AbsoluteUri,
new Dictionary<string, object?> new Dictionary<string, object?>
{ {
["userId"] = userId, ["userId"] = userId,
["code"] = code ["code"] = code
}); });
await EmailSender.SendConfirmationLinkAsync(user, Input.Email, HtmlEncoder.Default.Encode(callbackUrl)); await EmailSender.SendConfirmationLinkAsync(user, Input.Email, HtmlEncoder.Default.Encode(callbackUrl));
@@ -155,13 +154,13 @@
if(UserManager.Options.SignIn.RequireConfirmedAccount) if(UserManager.Options.SignIn.RequireConfirmedAccount)
{ {
RedirectManager.RedirectTo("Account/RegisterConfirmation", RedirectManager.RedirectTo("Account/RegisterConfirmation",
new() new Dictionary<string, object?>
{ {
["email"] = Input.Email ["email"] = Input.Email
}); });
} }
await SignInManager.SignInAsync(user, isPersistent: false, externalLoginInfo.LoginProvider); await SignInManager.SignInAsync(user, false, externalLoginInfo.LoginProvider);
RedirectManager.RedirectTo(ReturnUrl); RedirectManager.RedirectTo(ReturnUrl);
} }
} }

View File

@@ -1,11 +1,10 @@
@page "/Account/ForgotPassword" @page "/Account/ForgotPassword"
@using System.ComponentModel.DataAnnotations @using System.ComponentModel.DataAnnotations
@using System.Text @using System.Text
@using System.Text.Encodings.Web @using System.Text.Encodings.Web
@using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Identity @using Microsoft.AspNetCore.Identity
@using Microsoft.AspNetCore.WebUtilities @using Microsoft.AspNetCore.WebUtilities
@using Aaru.Server.New.Data
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject IEmailSender<ApplicationUser> EmailSender @inject IEmailSender<ApplicationUser> EmailSender
@@ -39,9 +38,9 @@
private async Task OnValidSubmitAsync() private async Task OnValidSubmitAsync()
{ {
var user = await UserManager.FindByEmailAsync(Input.Email); ApplicationUser? user = await UserManager.FindByEmailAsync(Input.Email);
if(user is null || !(await UserManager.IsEmailConfirmedAsync(user))) if(user is null || !await UserManager.IsEmailConfirmedAsync(user))
{ {
// Don't reveal that the user does not exist or is not confirmed // Don't reveal that the user does not exist or is not confirmed
RedirectManager.RedirectTo("Account/ForgotPasswordConfirmation"); RedirectManager.RedirectTo("Account/ForgotPasswordConfirmation");
@@ -49,14 +48,14 @@
// For more information on how to enable account confirmation and password reset please // For more information on how to enable account confirmation and password reset please
// visit https://go.microsoft.com/fwlink/?LinkID=532713 // visit https://go.microsoft.com/fwlink/?LinkID=532713
var code = await UserManager.GeneratePasswordResetTokenAsync(user); string code = await UserManager.GeneratePasswordResetTokenAsync(user);
code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code)); code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
var callbackUrl = NavigationManager.GetUriWithQueryParameters(NavigationManager.ToAbsoluteUri("Account/ResetPassword").AbsoluteUri, string callbackUrl = NavigationManager.GetUriWithQueryParameters(NavigationManager.ToAbsoluteUri("Account/ResetPassword").AbsoluteUri,
new Dictionary<string, object?> new Dictionary<string, object?>
{ {
["code"] = code ["code"] = code
}); });
await EmailSender.SendPasswordResetLinkAsync(user, Input.Email, HtmlEncoder.Default.Encode(callbackUrl)); await EmailSender.SendPasswordResetLinkAsync(user, Input.Email, HtmlEncoder.Default.Encode(callbackUrl));

View File

@@ -1,9 +1,8 @@
@page "/Account/Login" @page "/Account/Login"
@using System.ComponentModel.DataAnnotations @using System.ComponentModel.DataAnnotations
@using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Authentication @using Microsoft.AspNetCore.Authentication
@using Microsoft.AspNetCore.Identity @using Microsoft.AspNetCore.Identity
@using Aaru.Server.New.Data
@inject SignInManager<ApplicationUser> SignInManager @inject SignInManager<ApplicationUser> SignInManager
@inject ILogger<Login> Logger @inject ILogger<Login> Logger
@@ -89,7 +88,7 @@
{ {
// This doesn't count login failures towards account lockout // This doesn't count login failures towards account lockout
// To enable password failures to trigger account lockout, set lockoutOnFailure: true // To enable password failures to trigger account lockout, set lockoutOnFailure: true
var result = await SignInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: false); SignInResult result = await SignInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, false);
if(result.Succeeded) if(result.Succeeded)
{ {
@@ -99,7 +98,7 @@
else if(result.RequiresTwoFactor) else if(result.RequiresTwoFactor)
{ {
RedirectManager.RedirectTo("Account/LoginWith2fa", RedirectManager.RedirectTo("Account/LoginWith2fa",
new() new Dictionary<string, object?>
{ {
["returnUrl"] = ReturnUrl, ["returnUrl"] = ReturnUrl,
["rememberMe"] = Input.RememberMe ["rememberMe"] = Input.RememberMe

View File

@@ -1,8 +1,7 @@
@page "/Account/LoginWith2fa" @page "/Account/LoginWith2fa"
@using System.ComponentModel.DataAnnotations @using System.ComponentModel.DataAnnotations
@using Microsoft.AspNetCore.Identity
@using Aaru.Server.New.Data @using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Identity
@inject SignInManager<ApplicationUser> SignInManager @inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@@ -65,9 +64,9 @@
private async Task OnValidSubmitAsync() private async Task OnValidSubmitAsync()
{ {
var authenticatorCode = Input.TwoFactorCode!.Replace(" ", string.Empty).Replace("-", string.Empty); string authenticatorCode = Input.TwoFactorCode!.Replace(" ", string.Empty).Replace("-", string.Empty);
var result = await SignInManager.TwoFactorAuthenticatorSignInAsync(authenticatorCode, RememberMe, Input.RememberMachine); SignInResult result = await SignInManager.TwoFactorAuthenticatorSignInAsync(authenticatorCode, RememberMe, Input.RememberMachine);
var userId = await UserManager.GetUserIdAsync(user); string userId = await UserManager.GetUserIdAsync(user);
if(result.Succeeded) if(result.Succeeded)
{ {

View File

@@ -1,8 +1,7 @@
@page "/Account/LoginWithRecoveryCode" @page "/Account/LoginWithRecoveryCode"
@using System.ComponentModel.DataAnnotations @using System.ComponentModel.DataAnnotations
@using Microsoft.AspNetCore.Identity
@using Aaru.Server.New.Data @using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Identity
@inject SignInManager<ApplicationUser> SignInManager @inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@@ -51,11 +50,11 @@
private async Task OnValidSubmitAsync() private async Task OnValidSubmitAsync()
{ {
var recoveryCode = Input.RecoveryCode.Replace(" ", string.Empty); string recoveryCode = Input.RecoveryCode.Replace(" ", string.Empty);
var result = await SignInManager.TwoFactorRecoveryCodeSignInAsync(recoveryCode); SignInResult result = await SignInManager.TwoFactorRecoveryCodeSignInAsync(recoveryCode);
var userId = await UserManager.GetUserIdAsync(user); string userId = await UserManager.GetUserIdAsync(user);
if(result.Succeeded) if(result.Succeeded)
{ {

View File

@@ -1,8 +1,7 @@
@page "/Account/Manage/ChangePassword" @page "/Account/Manage/ChangePassword"
@using System.ComponentModel.DataAnnotations @using System.ComponentModel.DataAnnotations
@using Microsoft.AspNetCore.Identity
@using Aaru.Server.New.Data @using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Identity
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject SignInManager<ApplicationUser> SignInManager @inject SignInManager<ApplicationUser> SignInManager
@@ -63,7 +62,7 @@
private async Task OnValidSubmitAsync() private async Task OnValidSubmitAsync()
{ {
var changePasswordResult = await UserManager.ChangePasswordAsync(user, Input.OldPassword, Input.NewPassword); IdentityResult changePasswordResult = await UserManager.ChangePasswordAsync(user, Input.OldPassword, Input.NewPassword);
if(!changePasswordResult.Succeeded) if(!changePasswordResult.Succeeded)
{ {

View File

@@ -1,8 +1,7 @@
@page "/Account/Manage/DeletePersonalData" @page "/Account/Manage/DeletePersonalData"
@using System.ComponentModel.DataAnnotations @using System.ComponentModel.DataAnnotations
@using Microsoft.AspNetCore.Identity
@using Aaru.Server.New.Data @using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Identity
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject SignInManager<ApplicationUser> SignInManager @inject SignInManager<ApplicationUser> SignInManager
@@ -51,7 +50,7 @@
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
Input ??= new(); Input ??= new InputModel();
user = await UserAccessor.GetRequiredUserAsync(HttpContext); user = await UserAccessor.GetRequiredUserAsync(HttpContext);
requirePassword = await UserManager.HasPasswordAsync(user); requirePassword = await UserManager.HasPasswordAsync(user);
} }
@@ -65,7 +64,7 @@
return; return;
} }
var result = await UserManager.DeleteAsync(user); IdentityResult result = await UserManager.DeleteAsync(user);
if(!result.Succeeded) if(!result.Succeeded)
{ {
@@ -74,7 +73,7 @@
await SignInManager.SignOutAsync(); await SignInManager.SignOutAsync();
var userId = await UserManager.GetUserIdAsync(user); string userId = await UserManager.GetUserIdAsync(user);
Logger.LogInformation("User with ID '{UserId}' deleted themselves.", userId); Logger.LogInformation("User with ID '{UserId}' deleted themselves.", userId);
RedirectManager.RedirectToCurrentPage(); RedirectManager.RedirectToCurrentPage();

View File

@@ -1,7 +1,6 @@
@page "/Account/Manage/Disable2fa" @page "/Account/Manage/Disable2fa"
@using Microsoft.AspNetCore.Identity
@using Aaru.Server.New.Data @using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Identity
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject IdentityUserAccessor UserAccessor @inject IdentityUserAccessor UserAccessor
@@ -48,14 +47,14 @@
private async Task OnSubmitAsync() private async Task OnSubmitAsync()
{ {
var disable2faResult = await UserManager.SetTwoFactorEnabledAsync(user, false); IdentityResult disable2faResult = await UserManager.SetTwoFactorEnabledAsync(user, false);
if(!disable2faResult.Succeeded) if(!disable2faResult.Succeeded)
{ {
throw new InvalidOperationException("Unexpected error occurred disabling 2FA."); throw new InvalidOperationException("Unexpected error occurred disabling 2FA.");
} }
var userId = await UserManager.GetUserIdAsync(user); string userId = await UserManager.GetUserIdAsync(user);
Logger.LogInformation("User with ID '{UserId}' has disabled 2fa.", userId); Logger.LogInformation("User with ID '{UserId}' has disabled 2fa.", userId);
RedirectManager.RedirectToWithStatus("Account/Manage/TwoFactorAuthentication", "2fa has been disabled. You can reenable 2fa when you setup an authenticator app", HttpContext); RedirectManager.RedirectToWithStatus("Account/Manage/TwoFactorAuthentication", "2fa has been disabled. You can reenable 2fa when you setup an authenticator app", HttpContext);
} }

View File

@@ -1,11 +1,10 @@
@page "/Account/Manage/Email" @page "/Account/Manage/Email"
@using System.ComponentModel.DataAnnotations @using System.ComponentModel.DataAnnotations
@using System.Text @using System.Text
@using System.Text.Encodings.Web @using System.Text.Encodings.Web
@using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Identity @using Microsoft.AspNetCore.Identity
@using Microsoft.AspNetCore.WebUtilities @using Microsoft.AspNetCore.WebUtilities
@using Aaru.Server.New.Data
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject IEmailSender<ApplicationUser> EmailSender @inject IEmailSender<ApplicationUser> EmailSender
@@ -83,17 +82,17 @@
return; return;
} }
var userId = await UserManager.GetUserIdAsync(user); string userId = await UserManager.GetUserIdAsync(user);
var code = await UserManager.GenerateChangeEmailTokenAsync(user, Input.NewEmail); string code = await UserManager.GenerateChangeEmailTokenAsync(user, Input.NewEmail);
code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code)); code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
var callbackUrl = NavigationManager.GetUriWithQueryParameters(NavigationManager.ToAbsoluteUri("Account/ConfirmEmailChange").AbsoluteUri, string callbackUrl = NavigationManager.GetUriWithQueryParameters(NavigationManager.ToAbsoluteUri("Account/ConfirmEmailChange").AbsoluteUri,
new Dictionary<string, object?> new Dictionary<string, object?>
{ {
["userId"] = userId, ["userId"] = userId,
["email"] = Input.NewEmail, ["email"] = Input.NewEmail,
["code"] = code ["code"] = code
}); });
await EmailSender.SendConfirmationLinkAsync(user, Input.NewEmail, HtmlEncoder.Default.Encode(callbackUrl)); await EmailSender.SendConfirmationLinkAsync(user, Input.NewEmail, HtmlEncoder.Default.Encode(callbackUrl));
@@ -107,16 +106,16 @@
return; return;
} }
var userId = await UserManager.GetUserIdAsync(user); string userId = await UserManager.GetUserIdAsync(user);
var code = await UserManager.GenerateEmailConfirmationTokenAsync(user); string code = await UserManager.GenerateEmailConfirmationTokenAsync(user);
code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code)); code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
var callbackUrl = NavigationManager.GetUriWithQueryParameters(NavigationManager.ToAbsoluteUri("Account/ConfirmEmail").AbsoluteUri, string callbackUrl = NavigationManager.GetUriWithQueryParameters(NavigationManager.ToAbsoluteUri("Account/ConfirmEmail").AbsoluteUri,
new Dictionary<string, object?> new Dictionary<string, object?>
{ {
["userId"] = userId, ["userId"] = userId,
["code"] = code ["code"] = code
}); });
await EmailSender.SendConfirmationLinkAsync(user, email, HtmlEncoder.Default.Encode(callbackUrl)); await EmailSender.SendConfirmationLinkAsync(user, email, HtmlEncoder.Default.Encode(callbackUrl));

View File

@@ -1,11 +1,10 @@
@page "/Account/Manage/EnableAuthenticator" @page "/Account/Manage/EnableAuthenticator"
@using System.ComponentModel.DataAnnotations @using System.ComponentModel.DataAnnotations
@using System.Globalization @using System.Globalization
@using System.Text @using System.Text
@using System.Text.Encodings.Web @using System.Text.Encodings.Web
@using Microsoft.AspNetCore.Identity
@using Aaru.Server.New.Data @using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Identity
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject IdentityUserAccessor UserAccessor @inject IdentityUserAccessor UserAccessor
@@ -22,6 +21,7 @@
else else
{ {
<StatusMessage Message="@message"/> <StatusMessage Message="@message"/>
<h3>Configure authenticator app</h3> <h3>Configure authenticator app</h3>
<div> <div>
<p>To use an authenticator app go through the following steps:</p> <p>To use an authenticator app go through the following steps:</p>
@@ -91,9 +91,9 @@ else
private async Task OnValidSubmitAsync() private async Task OnValidSubmitAsync()
{ {
// Strip spaces and hyphens // Strip spaces and hyphens
var verificationCode = Input.Code.Replace(" ", string.Empty).Replace("-", string.Empty); string verificationCode = Input.Code.Replace(" ", string.Empty).Replace("-", string.Empty);
var is2faTokenValid = await UserManager.VerifyTwoFactorTokenAsync(user, UserManager.Options.Tokens.AuthenticatorTokenProvider, verificationCode); bool is2faTokenValid = await UserManager.VerifyTwoFactorTokenAsync(user, UserManager.Options.Tokens.AuthenticatorTokenProvider, verificationCode);
if(!is2faTokenValid) if(!is2faTokenValid)
{ {
@@ -103,7 +103,7 @@ else
} }
await UserManager.SetTwoFactorEnabledAsync(user, true); await UserManager.SetTwoFactorEnabledAsync(user, true);
var userId = await UserManager.GetUserIdAsync(user); string userId = await UserManager.GetUserIdAsync(user);
Logger.LogInformation("User with ID '{UserId}' has enabled 2FA with an authenticator app.", userId); Logger.LogInformation("User with ID '{UserId}' has enabled 2FA with an authenticator app.", userId);
message = "Your authenticator app has been verified."; message = "Your authenticator app has been verified.";
@@ -121,7 +121,7 @@ else
private async ValueTask LoadSharedKeyAndQrCodeUriAsync(ApplicationUser user) private async ValueTask LoadSharedKeyAndQrCodeUriAsync(ApplicationUser user)
{ {
// Load the authenticator key & QR code URI to display on the form // Load the authenticator key & QR code URI to display on the form
var unformattedKey = await UserManager.GetAuthenticatorKeyAsync(user); string? unformattedKey = await UserManager.GetAuthenticatorKeyAsync(user);
if(string.IsNullOrEmpty(unformattedKey)) if(string.IsNullOrEmpty(unformattedKey))
{ {
@@ -131,14 +131,14 @@ else
sharedKey = FormatKey(unformattedKey!); sharedKey = FormatKey(unformattedKey!);
var email = await UserManager.GetEmailAsync(user); string? email = await UserManager.GetEmailAsync(user);
authenticatorUri = GenerateQrCodeUri(email!, unformattedKey!); authenticatorUri = GenerateQrCodeUri(email!, unformattedKey!);
} }
private string FormatKey(string unformattedKey) private string FormatKey(string unformattedKey)
{ {
var result = new StringBuilder(); var result = new StringBuilder();
int currentPosition = 0; var currentPosition = 0;
while(currentPosition + 4 < unformattedKey.Length) while(currentPosition + 4 < unformattedKey.Length)
{ {
@@ -154,10 +154,7 @@ else
return result.ToString().ToLowerInvariant(); return result.ToString().ToLowerInvariant();
} }
private string GenerateQrCodeUri(string email, string unformattedKey) private string GenerateQrCodeUri(string email, string unformattedKey) => string.Format(CultureInfo.InvariantCulture, AuthenticatorUriFormat, UrlEncoder.Encode("Microsoft.AspNetCore.Identity.UI"), UrlEncoder.Encode(email), unformattedKey);
{
return string.Format(CultureInfo.InvariantCulture, AuthenticatorUriFormat, UrlEncoder.Encode("Microsoft.AspNetCore.Identity.UI"), UrlEncoder.Encode(email), unformattedKey);
}
private sealed class InputModel private sealed class InputModel
{ {

View File

@@ -1,8 +1,7 @@
@page "/Account/Manage/ExternalLogins" @page "/Account/Manage/ExternalLogins"
@using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Authentication @using Microsoft.AspNetCore.Authentication
@using Microsoft.AspNetCore.Identity @using Microsoft.AspNetCore.Identity
@using Aaru.Server.New.Data
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject SignInManager<ApplicationUser> SignInManager @inject SignInManager<ApplicationUser> SignInManager
@@ -18,7 +17,7 @@
<h3>Registered Logins</h3> <h3>Registered Logins</h3>
<table class="table"> <table class="table">
<tbody> <tbody>
@foreach(var login in currentLogins) @foreach(UserLoginInfo login in currentLogins)
{ {
<tr> <tr>
<td>@login.ProviderDisplayName</td> <td>@login.ProviderDisplayName</td>
@@ -52,7 +51,7 @@
<AntiforgeryToken/> <AntiforgeryToken/>
<div> <div>
<p> <p>
@foreach(var provider in otherLogins) @foreach(AuthenticationScheme provider in otherLogins)
{ {
<button class="btn btn-primary" name="Provider" title="Log in using your @provider.DisplayName account" type="submit" value="@provider.Name"> <button class="btn btn-primary" name="Provider" title="Log in using your @provider.DisplayName account" type="submit" value="@provider.Name">
@provider.DisplayName @provider.DisplayName
@@ -106,7 +105,7 @@
private async Task OnSubmitAsync() private async Task OnSubmitAsync()
{ {
var result = await UserManager.RemoveLoginAsync(user, LoginProvider!, ProviderKey!); IdentityResult result = await UserManager.RemoveLoginAsync(user, LoginProvider!, ProviderKey!);
if(!result.Succeeded) if(!result.Succeeded)
{ {
@@ -119,15 +118,15 @@
private async Task OnGetLinkLoginCallbackAsync() private async Task OnGetLinkLoginCallbackAsync()
{ {
var userId = await UserManager.GetUserIdAsync(user); string userId = await UserManager.GetUserIdAsync(user);
var info = await SignInManager.GetExternalLoginInfoAsync(userId); ExternalLoginInfo? info = await SignInManager.GetExternalLoginInfoAsync(userId);
if(info is null) if(info is null)
{ {
RedirectManager.RedirectToCurrentPageWithStatus("Error: Could not load external login info.", HttpContext); RedirectManager.RedirectToCurrentPageWithStatus("Error: Could not load external login info.", HttpContext);
} }
var result = await UserManager.AddLoginAsync(user, info); IdentityResult result = await UserManager.AddLoginAsync(user, info);
if(!result.Succeeded) if(!result.Succeeded)
{ {

View File

@@ -1,7 +1,6 @@
@page "/Account/Manage/GenerateRecoveryCodes" @page "/Account/Manage/GenerateRecoveryCodes"
@using Microsoft.AspNetCore.Identity
@using Aaru.Server.New.Data @using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Identity
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject IdentityUserAccessor UserAccessor @inject IdentityUserAccessor UserAccessor
@@ -50,7 +49,7 @@ else
{ {
user = await UserAccessor.GetRequiredUserAsync(HttpContext); user = await UserAccessor.GetRequiredUserAsync(HttpContext);
var isTwoFactorEnabled = await UserManager.GetTwoFactorEnabledAsync(user); bool isTwoFactorEnabled = await UserManager.GetTwoFactorEnabledAsync(user);
if(!isTwoFactorEnabled) if(!isTwoFactorEnabled)
{ {
@@ -60,7 +59,7 @@ else
private async Task OnSubmitAsync() private async Task OnSubmitAsync()
{ {
var userId = await UserManager.GetUserIdAsync(user); string userId = await UserManager.GetUserIdAsync(user);
recoveryCodes = await UserManager.GenerateNewTwoFactorRecoveryCodesAsync(user, 10); recoveryCodes = await UserManager.GenerateNewTwoFactorRecoveryCodesAsync(user, 10);
message = "You have generated new recovery codes."; message = "You have generated new recovery codes.";

View File

@@ -1,8 +1,7 @@
@page "/Account/Manage" @page "/Account/Manage"
@using System.ComponentModel.DataAnnotations @using System.ComponentModel.DataAnnotations
@using Microsoft.AspNetCore.Identity
@using Aaru.Server.New.Data @using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Identity
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject SignInManager<ApplicationUser> SignInManager @inject SignInManager<ApplicationUser> SignInManager
@@ -57,7 +56,7 @@
{ {
if(Input.PhoneNumber != phoneNumber) if(Input.PhoneNumber != phoneNumber)
{ {
var setPhoneResult = await UserManager.SetPhoneNumberAsync(user, Input.PhoneNumber); IdentityResult setPhoneResult = await UserManager.SetPhoneNumberAsync(user, Input.PhoneNumber);
if(!setPhoneResult.Succeeded) if(!setPhoneResult.Succeeded)
{ {

View File

@@ -1,7 +1,6 @@
@page "/Account/Manage/ResetAuthenticator" @page "/Account/Manage/ResetAuthenticator"
@using Microsoft.AspNetCore.Identity
@using Aaru.Server.New.Data @using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Identity
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject SignInManager<ApplicationUser> SignInManager @inject SignInManager<ApplicationUser> SignInManager
@@ -36,10 +35,10 @@
private async Task OnSubmitAsync() private async Task OnSubmitAsync()
{ {
var user = await UserAccessor.GetRequiredUserAsync(HttpContext); ApplicationUser user = await UserAccessor.GetRequiredUserAsync(HttpContext);
await UserManager.SetTwoFactorEnabledAsync(user, false); await UserManager.SetTwoFactorEnabledAsync(user, false);
await UserManager.ResetAuthenticatorKeyAsync(user); await UserManager.ResetAuthenticatorKeyAsync(user);
var userId = await UserManager.GetUserIdAsync(user); string userId = await UserManager.GetUserIdAsync(user);
Logger.LogInformation("User with ID '{UserId}' has reset their authentication app key.", userId); Logger.LogInformation("User with ID '{UserId}' has reset their authentication app key.", userId);
await SignInManager.RefreshSignInAsync(user); await SignInManager.RefreshSignInAsync(user);

View File

@@ -1,8 +1,7 @@
@page "/Account/Manage/SetPassword" @page "/Account/Manage/SetPassword"
@using System.ComponentModel.DataAnnotations @using System.ComponentModel.DataAnnotations
@using Microsoft.AspNetCore.Identity
@using Aaru.Server.New.Data @using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Identity
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject SignInManager<ApplicationUser> SignInManager @inject SignInManager<ApplicationUser> SignInManager
@@ -51,7 +50,7 @@
{ {
user = await UserAccessor.GetRequiredUserAsync(HttpContext); user = await UserAccessor.GetRequiredUserAsync(HttpContext);
var hasPassword = await UserManager.HasPasswordAsync(user); bool hasPassword = await UserManager.HasPasswordAsync(user);
if(hasPassword) if(hasPassword)
{ {
@@ -61,7 +60,7 @@
private async Task OnValidSubmitAsync() private async Task OnValidSubmitAsync()
{ {
var addPasswordResult = await UserManager.AddPasswordAsync(user, Input.NewPassword!); IdentityResult addPasswordResult = await UserManager.AddPasswordAsync(user, Input.NewPassword!);
if(!addPasswordResult.Succeeded) if(!addPasswordResult.Succeeded)
{ {

View File

@@ -1,8 +1,7 @@
@page "/Account/Manage/TwoFactorAuthentication" @page "/Account/Manage/TwoFactorAuthentication"
@using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Http.Features @using Microsoft.AspNetCore.Http.Features
@using Microsoft.AspNetCore.Identity @using Microsoft.AspNetCore.Identity
@using Aaru.Server.New.Data
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject SignInManager<ApplicationUser> SignInManager @inject SignInManager<ApplicationUser> SignInManager
@@ -83,7 +82,7 @@ else
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
var user = await UserAccessor.GetRequiredUserAsync(HttpContext); ApplicationUser user = await UserAccessor.GetRequiredUserAsync(HttpContext);
canTrack = HttpContext.Features.Get<ITrackingConsentFeature>()?.CanTrack ?? true; canTrack = HttpContext.Features.Get<ITrackingConsentFeature>()?.CanTrack ?? true;
hasAuthenticator = await UserManager.GetAuthenticatorKeyAsync(user) is not null; hasAuthenticator = await UserManager.GetAuthenticatorKeyAsync(user) is not null;
is2faEnabled = await UserManager.GetTwoFactorEnabledAsync(user); is2faEnabled = await UserManager.GetTwoFactorEnabledAsync(user);

View File

@@ -1,2 +1,3 @@
@layout ManageLayout @using Microsoft.AspNetCore.Authorization
@attribute [Microsoft.AspNetCore.Authorization.Authorize] @layout ManageLayout
@attribute [Authorize]

View File

@@ -1,11 +1,10 @@
@page "/Account/Register" @page "/Account/Register"
@using System.ComponentModel.DataAnnotations @using System.ComponentModel.DataAnnotations
@using System.Text @using System.Text
@using System.Text.Encodings.Web @using System.Text.Encodings.Web
@using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Identity @using Microsoft.AspNetCore.Identity
@using Microsoft.AspNetCore.WebUtilities @using Microsoft.AspNetCore.WebUtilities
@using Aaru.Server.New.Data
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject IUserStore<ApplicationUser> UserStore @inject IUserStore<ApplicationUser> UserStore
@@ -67,12 +66,12 @@
public async Task RegisterUser(EditContext editContext) public async Task RegisterUser(EditContext editContext)
{ {
var user = CreateUser(); ApplicationUser user = CreateUser();
await UserStore.SetUserNameAsync(user, Input.Email, CancellationToken.None); await UserStore.SetUserNameAsync(user, Input.Email, CancellationToken.None);
var emailStore = GetEmailStore(); IUserEmailStore<ApplicationUser> emailStore = GetEmailStore();
await emailStore.SetEmailAsync(user, Input.Email, CancellationToken.None); await emailStore.SetEmailAsync(user, Input.Email, CancellationToken.None);
var result = await UserManager.CreateAsync(user, Input.Password); IdentityResult result = await UserManager.CreateAsync(user, Input.Password);
if(!result.Succeeded) if(!result.Succeeded)
{ {
@@ -83,31 +82,31 @@
Logger.LogInformation("User created a new account with password."); Logger.LogInformation("User created a new account with password.");
var userId = await UserManager.GetUserIdAsync(user); string userId = await UserManager.GetUserIdAsync(user);
var code = await UserManager.GenerateEmailConfirmationTokenAsync(user); string code = await UserManager.GenerateEmailConfirmationTokenAsync(user);
code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code)); code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
var callbackUrl = NavigationManager.GetUriWithQueryParameters(NavigationManager.ToAbsoluteUri("Account/ConfirmEmail").AbsoluteUri, string callbackUrl = NavigationManager.GetUriWithQueryParameters(NavigationManager.ToAbsoluteUri("Account/ConfirmEmail").AbsoluteUri,
new Dictionary<string, object?> new Dictionary<string, object?>
{ {
["userId"] = userId, ["userId"] = userId,
["code"] = code, ["code"] = code,
["returnUrl"] = ReturnUrl ["returnUrl"] = ReturnUrl
}); });
await EmailSender.SendConfirmationLinkAsync(user, Input.Email, HtmlEncoder.Default.Encode(callbackUrl)); await EmailSender.SendConfirmationLinkAsync(user, Input.Email, HtmlEncoder.Default.Encode(callbackUrl));
if(UserManager.Options.SignIn.RequireConfirmedAccount) if(UserManager.Options.SignIn.RequireConfirmedAccount)
{ {
RedirectManager.RedirectTo("Account/RegisterConfirmation", RedirectManager.RedirectTo("Account/RegisterConfirmation",
new() new Dictionary<string, object?>
{ {
["email"] = Input.Email, ["email"] = Input.Email,
["returnUrl"] = ReturnUrl ["returnUrl"] = ReturnUrl
}); });
} }
await SignInManager.SignInAsync(user, isPersistent: false); await SignInManager.SignInAsync(user, false);
RedirectManager.RedirectTo(ReturnUrl); RedirectManager.RedirectTo(ReturnUrl);
} }

View File

@@ -1,9 +1,8 @@
@page "/Account/RegisterConfirmation" @page "/Account/RegisterConfirmation"
@using System.Text @using System.Text
@using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Identity @using Microsoft.AspNetCore.Identity
@using Microsoft.AspNetCore.WebUtilities @using Microsoft.AspNetCore.WebUtilities
@using Aaru.Server.New.Data
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject IEmailSender<ApplicationUser> EmailSender @inject IEmailSender<ApplicationUser> EmailSender
@@ -48,7 +47,7 @@ else
RedirectManager.RedirectTo(""); RedirectManager.RedirectTo("");
} }
var user = await UserManager.FindByEmailAsync(Email); ApplicationUser? user = await UserManager.FindByEmailAsync(Email);
if(user is null) if(user is null)
{ {
@@ -58,8 +57,8 @@ else
else if(EmailSender is IdentityNoOpEmailSender) else if(EmailSender is IdentityNoOpEmailSender)
{ {
// Once you add a real email sender, you should remove this code that lets you confirm the account // Once you add a real email sender, you should remove this code that lets you confirm the account
var userId = await UserManager.GetUserIdAsync(user); string userId = await UserManager.GetUserIdAsync(user);
var code = await UserManager.GenerateEmailConfirmationTokenAsync(user); string code = await UserManager.GenerateEmailConfirmationTokenAsync(user);
code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code)); code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
emailConfirmationLink = NavigationManager.GetUriWithQueryParameters(NavigationManager.ToAbsoluteUri("Account/ConfirmEmail").AbsoluteUri, emailConfirmationLink = NavigationManager.GetUriWithQueryParameters(NavigationManager.ToAbsoluteUri("Account/ConfirmEmail").AbsoluteUri,

View File

@@ -1,11 +1,10 @@
@page "/Account/ResendEmailConfirmation" @page "/Account/ResendEmailConfirmation"
@using System.ComponentModel.DataAnnotations @using System.ComponentModel.DataAnnotations
@using System.Text @using System.Text
@using System.Text.Encodings.Web @using System.Text.Encodings.Web
@using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Identity @using Microsoft.AspNetCore.Identity
@using Microsoft.AspNetCore.WebUtilities @using Microsoft.AspNetCore.WebUtilities
@using Aaru.Server.New.Data
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject IEmailSender<ApplicationUser> EmailSender @inject IEmailSender<ApplicationUser> EmailSender
@@ -41,7 +40,7 @@
private async Task OnValidSubmitAsync() private async Task OnValidSubmitAsync()
{ {
var user = await UserManager.FindByEmailAsync(Input.Email!); ApplicationUser? user = await UserManager.FindByEmailAsync(Input.Email!);
if(user is null) if(user is null)
{ {
@@ -50,16 +49,16 @@
return; return;
} }
var userId = await UserManager.GetUserIdAsync(user); string userId = await UserManager.GetUserIdAsync(user);
var code = await UserManager.GenerateEmailConfirmationTokenAsync(user); string code = await UserManager.GenerateEmailConfirmationTokenAsync(user);
code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code)); code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
var callbackUrl = NavigationManager.GetUriWithQueryParameters(NavigationManager.ToAbsoluteUri("Account/ConfirmEmail").AbsoluteUri, string callbackUrl = NavigationManager.GetUriWithQueryParameters(NavigationManager.ToAbsoluteUri("Account/ConfirmEmail").AbsoluteUri,
new Dictionary<string, object?> new Dictionary<string, object?>
{ {
["userId"] = userId, ["userId"] = userId,
["code"] = code ["code"] = code
}); });
await EmailSender.SendConfirmationLinkAsync(user, Input.Email, HtmlEncoder.Default.Encode(callbackUrl)); await EmailSender.SendConfirmationLinkAsync(user, Input.Email, HtmlEncoder.Default.Encode(callbackUrl));

View File

@@ -1,10 +1,9 @@
@page "/Account/ResetPassword" @page "/Account/ResetPassword"
@using System.ComponentModel.DataAnnotations @using System.ComponentModel.DataAnnotations
@using System.Text @using System.Text
@using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Identity @using Microsoft.AspNetCore.Identity
@using Microsoft.AspNetCore.WebUtilities @using Microsoft.AspNetCore.WebUtilities
@using Aaru.Server.New.Data
@inject IdentityRedirectManager RedirectManager @inject IdentityRedirectManager RedirectManager
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@@ -65,7 +64,7 @@
private async Task OnValidSubmitAsync() private async Task OnValidSubmitAsync()
{ {
var user = await UserManager.FindByEmailAsync(Input.Email); ApplicationUser? user = await UserManager.FindByEmailAsync(Input.Email);
if(user is null) if(user is null)
{ {
@@ -73,7 +72,7 @@
RedirectManager.RedirectTo("Account/ResetPasswordConfirmation"); RedirectManager.RedirectTo("Account/ResetPasswordConfirmation");
} }
var result = await UserManager.ResetPasswordAsync(user, Input.Code, Input.Password); IdentityResult result = await UserManager.ResetPasswordAsync(user, Input.Code, Input.Password);
if(result.Succeeded) if(result.Succeeded)
{ {

View File

@@ -1,5 +1,6 @@
@inherits LayoutComponentBase @using Aaru.Server.New.Components.Layout
@layout Aaru.Server.New.Components.Layout.MainLayout @inherits LayoutComponentBase
@layout MainLayout
@inject NavigationManager NavigationManager @inject NavigationManager NavigationManager
@if(HttpContext is null) @if(HttpContext is null)
@@ -22,7 +23,7 @@ else
// If this code runs, we're currently rendering in interactive mode, so there is no HttpContext. // If this code runs, we're currently rendering in interactive mode, so there is no HttpContext.
// The identity pages need to set cookies, so they require an HttpContext. To achieve this we // The identity pages need to set cookies, so they require an HttpContext. To achieve this we
// must transition back from interactive mode to a server-rendered page. // must transition back from interactive mode to a server-rendered page.
NavigationManager.Refresh(forceReload: true); NavigationManager.Refresh(true);
} }
} }

View File

@@ -1,7 +1,6 @@
@using Microsoft.AspNetCore.Authentication @using Aaru.Server.New.Data
@using Microsoft.AspNetCore.Authentication
@using Microsoft.AspNetCore.Identity @using Microsoft.AspNetCore.Identity
@using Aaru.Server.New.Data
@inject SignInManager<ApplicationUser> SignInManager @inject SignInManager<ApplicationUser> SignInManager
@inject IdentityRedirectManager RedirectManager @inject IdentityRedirectManager RedirectManager
@@ -24,7 +23,7 @@ else
<AntiforgeryToken/> <AntiforgeryToken/>
<input name="ReturnUrl" type="hidden" value="@ReturnUrl"/> <input name="ReturnUrl" type="hidden" value="@ReturnUrl"/>
<p> <p>
@foreach(var provider in externalLogins) @foreach(AuthenticationScheme provider in externalLogins)
{ {
<button class="btn btn-primary" name="provider" title="Log in using your @provider.DisplayName account" type="submit" value="@provider.Name">@provider.DisplayName</button> <button class="btn btn-primary" name="provider" title="Log in using your @provider.DisplayName account" type="submit" value="@provider.Name">@provider.DisplayName</button>
} }

View File

@@ -1,6 +1,5 @@
@using Microsoft.AspNetCore.Identity @using Aaru.Server.New.Data
@using Aaru.Server.New.Data @using Microsoft.AspNetCore.Identity
@inject SignInManager<ApplicationUser> SignInManager @inject SignInManager<ApplicationUser> SignInManager
<ul class="flex-column nav nav-pills"> <ul class="flex-column nav nav-pills">

View File

@@ -4,7 +4,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
NavigationManager.NavigateTo($"Account/Login?returnUrl={Uri.EscapeDataString(NavigationManager.Uri)}", forceLoad: true); NavigationManager.NavigateTo($"Account/Login?returnUrl={Uri.EscapeDataString(NavigationManager.Uri)}", true);
} }
} }

View File

@@ -10,7 +10,7 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@foreach(var recoveryCode in RecoveryCodes) @foreach(string recoveryCode in RecoveryCodes)
{ {
<div> <div>
<code class="recovery-code">@recoveryCode</code> <code class="recovery-code">@recoveryCode</code>

View File

@@ -1,6 +1,6 @@
@if(!string.IsNullOrEmpty(DisplayMessage)) @if(!string.IsNullOrEmpty(DisplayMessage))
{ {
var statusMessageClass = DisplayMessage.StartsWith("Error") ? "danger" : "success"; string statusMessageClass = DisplayMessage.StartsWith("Error") ? "danger" : "success";
<div class="alert alert-@statusMessageClass" role="alert"> <div class="alert alert-@statusMessageClass" role="alert">
@DisplayMessage @DisplayMessage
</div> </div>

View File

@@ -1,96 +1,96 @@
.page { .page {
position: relative; position: relative;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
main { main {
flex: 1; flex: 1;
} }
.sidebar { .sidebar {
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
} }
.top-row { .top-row {
background-color: #f7f7f7; background-color: #f7f7f7;
border-bottom: 1px solid #d6d5d5; border-bottom: 1px solid #d6d5d5;
justify-content: flex-end; justify-content: flex-end;
height: 3.5rem; height: 3.5rem;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.top-row ::deep a, .top-row ::deep .btn-link { .top-row ::deep a, .top-row ::deep .btn-link {
white-space: nowrap; white-space: nowrap;
margin-left: 1.5rem; margin-left: 1.5rem;
text-decoration: none; text-decoration: none;
} }
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover { .top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
text-decoration: underline; text-decoration: underline;
} }
.top-row ::deep a:first-child { .top-row ::deep a:first-child {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
@media (max-width: 640.98px) { @media (max-width: 640.98px) {
.top-row { .top-row {
justify-content: space-between; justify-content: space-between;
} }
.top-row ::deep a, .top-row ::deep .btn-link { .top-row ::deep a, .top-row ::deep .btn-link {
margin-left: 0; margin-left: 0;
} }
} }
@media (min-width: 641px) { @media (min-width: 641px) {
.page { .page {
flex-direction: row; flex-direction: row;
} }
.sidebar { .sidebar {
width: 250px; width: 250px;
height: 100vh; height: 100vh;
position: sticky; position: sticky;
top: 0; top: 0;
} }
.top-row { .top-row {
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 1; z-index: 1;
} }
.top-row.auth ::deep a:first-child { .top-row.auth ::deep a:first-child {
flex: 1; flex: 1;
text-align: right; text-align: right;
width: 0; width: 0;
} }
.top-row, article { .top-row, article {
padding-left: 2rem !important; padding-left: 2rem !important;
padding-right: 1.5rem !important; padding-right: 1.5rem !important;
} }
} }
#blazor-error-ui { #blazor-error-ui {
background: lightyellow; background: lightyellow;
bottom: 0; bottom: 0;
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
display: none; display: none;
left: 0; left: 0;
padding: 0.6rem 1.25rem 0.7rem 1.25rem; padding: 0.6rem 1.25rem 0.7rem 1.25rem;
position: fixed; position: fixed;
width: 100%; width: 100%;
z-index: 1000; z-index: 1000;
} }
#blazor-error-ui .dismiss { #blazor-error-ui .dismiss {
cursor: pointer; cursor: pointer;
position: absolute; position: absolute;
right: 0.75rem; right: 0.75rem;
top: 0.5rem; top: 0.5rem;
} }

View File

@@ -1,125 +1,125 @@
.navbar-toggler { .navbar-toggler {
appearance: none; appearance: none;
cursor: pointer; cursor: pointer;
width: 3.5rem; width: 3.5rem;
height: 2.5rem; height: 2.5rem;
color: white; color: white;
position: absolute; position: absolute;
top: 0.5rem; top: 0.5rem;
right: 1rem; right: 1rem;
border: 1px solid rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.1);
background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") no-repeat center/1.75rem rgba(255, 255, 255, 0.1); background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") no-repeat center/1.75rem rgba(255, 255, 255, 0.1);
} }
.navbar-toggler:checked { .navbar-toggler:checked {
background-color: rgba(255, 255, 255, 0.5); background-color: rgba(255, 255, 255, 0.5);
} }
.top-row { .top-row {
height: 3.5rem; height: 3.5rem;
background-color: rgba(0,0,0,0.4); background-color: rgba(0, 0, 0, 0.4);
} }
.navbar-brand { .navbar-brand {
font-size: 1.1rem; font-size: 1.1rem;
} }
.bi { .bi {
display: inline-block; display: inline-block;
position: relative; position: relative;
width: 1.25rem; width: 1.25rem;
height: 1.25rem; height: 1.25rem;
margin-right: 0.75rem; margin-right: 0.75rem;
top: -1px; top: -1px;
background-size: cover; background-size: cover;
} }
.bi-house-door-fill-nav-menu { .bi-house-door-fill-nav-menu {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-house-door-fill' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 14.5v-3.505c0-.245.25-.495.5-.495h2c.25 0 .5.25.5.5v3.5a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5Z'/%3E%3C/svg%3E"); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-house-door-fill' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 14.5v-3.505c0-.245.25-.495.5-.495h2c.25 0 .5.25.5.5v3.5a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5Z'/%3E%3C/svg%3E");
} }
.bi-plus-square-fill-nav-menu { .bi-plus-square-fill-nav-menu {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-plus-square-fill' viewBox='0 0 16 16'%3E%3Cpath d='M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm6.5 4.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3a.5.5 0 0 1 1 0z'/%3E%3C/svg%3E"); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-plus-square-fill' viewBox='0 0 16 16'%3E%3Cpath d='M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm6.5 4.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3a.5.5 0 0 1 1 0z'/%3E%3C/svg%3E");
} }
.bi-list-nested-nav-menu { .bi-list-nested-nav-menu {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M4.5 11.5A.5.5 0 0 1 5 11h10a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 1 3h10a.5.5 0 0 1 0 1H1a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E"); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M4.5 11.5A.5.5 0 0 1 5 11h10a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 1 3h10a.5.5 0 0 1 0 1H1a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E");
} }
.bi-lock-nav-menu { .bi-lock-nav-menu {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath d='M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2zM5 8h6a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1z'/%3E%3C/svg%3E"); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath d='M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2zM5 8h6a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1z'/%3E%3C/svg%3E");
} }
.bi-person-nav-menu { .bi-person-nav-menu {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-person' viewBox='0 0 16 16'%3E%3Cpath d='M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4Zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332-.678.678-.83 1.418-.832 1.664h10Z'/%3E%3C/svg%3E"); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-person' viewBox='0 0 16 16'%3E%3Cpath d='M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4Zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332-.678.678-.83 1.418-.832 1.664h10Z'/%3E%3C/svg%3E");
} }
.bi-person-badge-nav-menu { .bi-person-badge-nav-menu {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-person-badge' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 2a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1h-3zM11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0z'/%3E%3Cpath d='M4.5 0A2.5 2.5 0 0 0 2 2.5V14a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V2.5A2.5 2.5 0 0 0 11.5 0h-7zM3 2.5A1.5 1.5 0 0 1 4.5 1h7A1.5 1.5 0 0 1 13 2.5v10.795a4.2 4.2 0 0 0-.776-.492C11.392 12.387 10.063 12 8 12s-3.392.387-4.224.803a4.2 4.2 0 0 0-.776.492V2.5z'/%3E%3C/svg%3E"); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-person-badge' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 2a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1h-3zM11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0z'/%3E%3Cpath d='M4.5 0A2.5 2.5 0 0 0 2 2.5V14a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V2.5A2.5 2.5 0 0 0 11.5 0h-7zM3 2.5A1.5 1.5 0 0 1 4.5 1h7A1.5 1.5 0 0 1 13 2.5v10.795a4.2 4.2 0 0 0-.776-.492C11.392 12.387 10.063 12 8 12s-3.392.387-4.224.803a4.2 4.2 0 0 0-.776.492V2.5z'/%3E%3C/svg%3E");
} }
.bi-person-fill-nav-menu { .bi-person-fill-nav-menu {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-person-fill' viewBox='0 0 16 16'%3E%3Cpath d='M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3Zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z'/%3E%3C/svg%3E"); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-person-fill' viewBox='0 0 16 16'%3E%3Cpath d='M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3Zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z'/%3E%3C/svg%3E");
} }
.bi-arrow-bar-left-nav-menu { .bi-arrow-bar-left-nav-menu {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-arrow-bar-left' viewBox='0 0 16 16'%3E%3Cpath d='M12.5 15a.5.5 0 0 1-.5-.5v-13a.5.5 0 0 1 1 0v13a.5.5 0 0 1-.5.5ZM10 8a.5.5 0 0 1-.5.5H3.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L3.707 7.5H9.5a.5.5 0 0 1 .5.5Z'/%3E%3C/svg%3E"); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-arrow-bar-left' viewBox='0 0 16 16'%3E%3Cpath d='M12.5 15a.5.5 0 0 1-.5-.5v-13a.5.5 0 0 1 1 0v13a.5.5 0 0 1-.5.5ZM10 8a.5.5 0 0 1-.5.5H3.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L3.707 7.5H9.5a.5.5 0 0 1 .5.5Z'/%3E%3C/svg%3E");
} }
.nav-item { .nav-item {
font-size: 0.9rem; font-size: 0.9rem;
padding-bottom: 0.5rem; padding-bottom: 0.5rem;
} }
.nav-item:first-of-type { .nav-item:first-of-type {
padding-top: 1rem; padding-top: 1rem;
} }
.nav-item:last-of-type { .nav-item:last-of-type {
padding-bottom: 1rem; padding-bottom: 1rem;
} }
.nav-item ::deep .nav-link { .nav-item ::deep .nav-link {
color: #d7d7d7; color: #d7d7d7;
background: none; background: none;
border: none; border: none;
border-radius: 4px; border-radius: 4px;
height: 3rem; height: 3rem;
display: flex; display: flex;
align-items: center; align-items: center;
line-height: 3rem; line-height: 3rem;
width: 100%; width: 100%;
} }
.nav-item ::deep a.active { .nav-item ::deep a.active {
background-color: rgba(255,255,255,0.37); background-color: rgba(255, 255, 255, 0.37);
color: white; color: white;
} }
.nav-item ::deep .nav-link:hover { .nav-item ::deep .nav-link:hover {
background-color: rgba(255,255,255,0.1); background-color: rgba(255, 255, 255, 0.1);
color: white; color: white;
} }
.nav-scrollable { .nav-scrollable {
display: none; display: none;
} }
.navbar-toggler:checked ~ .nav-scrollable { .navbar-toggler:checked ~ .nav-scrollable {
display: block; display: block;
} }
@media (min-width: 641px) { @media (min-width: 641px) {
.navbar-toggler { .navbar-toggler {
display: none; display: none;
} }
.nav-scrollable { .nav-scrollable {
/* Never collapse the sidebar for wide screens */ /* Never collapse the sidebar for wide screens */
display: block; display: block;
/* Allow sidebar to scroll for tall menus */ /* Allow sidebar to scroll for tall menus */
height: calc(100vh - 3.5rem); height: calc(100vh - 3.5rem);
overflow-y: auto; overflow-y: auto;
} }
} }

View File

@@ -1,5 +1,4 @@
@page "/auth" @page "/auth"
@using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Authorization
@attribute [Authorize] @attribute [Authorize]

View File

@@ -10,7 +10,7 @@
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button> <button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
@code { @code {
private int currentCount = 0; private int currentCount;
private void IncrementCount() private void IncrementCount()
{ {

View File

@@ -25,7 +25,7 @@ else
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@foreach(var forecast in forecasts) @foreach(WeatherForecast forecast in forecasts)
{ {
<tr> <tr>
<td>@forecast.Date.ToShortDateString()</td> <td>@forecast.Date.ToShortDateString()</td>
@@ -48,7 +48,7 @@ else
var startDate = DateOnly.FromDateTime(DateTime.Now); var startDate = DateOnly.FromDateTime(DateTime.Now);
var summaries = new[] string[] summaries = new[]
{ {
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
}; };

View File

@@ -1,7 +1,8 @@
@using Aaru.Server.New.Components.Account.Shared @using Aaru.Server.New.Components.Account.Shared
@using Aaru.Server.New.Components.Layout
<Router AppAssembly="typeof(Program).Assembly"> <Router AppAssembly="typeof(Program).Assembly">
<Found Context="routeData"> <Found Context="routeData">
<AuthorizeRouteView DefaultLayout="typeof(Layout.MainLayout)" RouteData="routeData"> <AuthorizeRouteView DefaultLayout="typeof(MainLayout)" RouteData="routeData">
<NotAuthorized> <NotAuthorized>
<RedirectToLogin/> <RedirectToLogin/>
</NotAuthorized> </NotAuthorized>

View File

@@ -1,11 +1,11 @@
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Aaru.Server.New.Components; using Aaru.Server.New.Components;
using Aaru.Server.New.Components.Account; using Aaru.Server.New.Components.Account;
using Aaru.Server.New.Data; using Aaru.Server.New.Data;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
var builder = WebApplication.CreateBuilder(args); WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
// Add services to the container. // Add services to the container.
builder.Services.AddRazorComponents().AddInteractiveServerComponents(); builder.Services.AddRazorComponents().AddInteractiveServerComponents();
@@ -22,8 +22,8 @@ builder.Services.AddAuthentication(options =>
}) })
.AddIdentityCookies(); .AddIdentityCookies();
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ?? string connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ??
throw new InvalidOperationException("Connection string 'DefaultConnection' not found."); throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");
builder.Services.AddDbContext<ApplicationDbContext>(options => options.UseSqlite(connectionString)); builder.Services.AddDbContext<ApplicationDbContext>(options => options.UseSqlite(connectionString));
builder.Services.AddDatabaseDeveloperPageExceptionFilter(); builder.Services.AddDatabaseDeveloperPageExceptionFilter();
@@ -35,16 +35,14 @@ builder.Services.AddIdentityCore<ApplicationUser>(options => options.SignIn.Requ
builder.Services.AddSingleton<IEmailSender<ApplicationUser>, IdentityNoOpEmailSender>(); builder.Services.AddSingleton<IEmailSender<ApplicationUser>, IdentityNoOpEmailSender>();
var app = builder.Build(); WebApplication app = builder.Build();
// Configure the HTTP request pipeline. // Configure the HTTP request pipeline.
if(app.Environment.IsDevelopment()) if(app.Environment.IsDevelopment())
{
app.UseMigrationsEndPoint(); app.UseMigrationsEndPoint();
}
else else
{ {
app.UseExceptionHandler("/Error", createScopeForErrors: true); app.UseExceptionHandler("/Error", true);
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts(); app.UseHsts();

View File

@@ -1,38 +1,38 @@
{ {
"$schema": "http://json.schemastore.org/launchsettings.json", "$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": { "iisSettings": {
"windowsAuthentication": false, "windowsAuthentication": false,
"anonymousAuthentication": true, "anonymousAuthentication": true,
"iisExpress": { "iisExpress": {
"applicationUrl": "http://localhost:24383", "applicationUrl": "http://localhost:24383",
"sslPort": 44391 "sslPort": 44391
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5279",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
} }
}, },
"profiles": { "https": {
"http": { "commandName": "Project",
"commandName": "Project", "dotnetRunMessages": true,
"dotnetRunMessages": true, "launchBrowser": true,
"launchBrowser": true, "applicationUrl": "https://localhost:7089;http://localhost:5279",
"applicationUrl": "http://localhost:5279", "environmentVariables": {
"environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development"
"ASPNETCORE_ENVIRONMENT": "Development" }
} },
}, "IIS Express": {
"https": { "commandName": "IISExpress",
"commandName": "Project", "launchBrowser": true,
"dotnetRunMessages": true, "environmentVariables": {
"launchBrowser": true, "ASPNETCORE_ENVIRONMENT": "Development"
"applicationUrl": "https://localhost:7089;http://localhost:5279",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
} }
} }
} }
}

View File

@@ -1,7 +1,7 @@
{ {
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Information", "Default": "Information",
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
} }

View File

@@ -2,11 +2,11 @@
"ConnectionStrings": { "ConnectionStrings": {
"DefaultConnection": "DataSource=Data\\app.db;Cache=Shared" "DefaultConnection": "DataSource=Data\\app.db;Cache=Shared"
}, },
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Information", "Default": "Information",
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
}, },
"AllowedHosts": "*" "AllowedHosts": "*"
} }

View File

@@ -1,15 +1,15 @@
html, body { html, body {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
} }
a, .btn-link { a, .btn-link {
color: #006bb7; color: #006bb7;
} }
.btn-primary { .btn-primary {
color: #fff; color: #fff;
background-color: #1b6ec2; background-color: #1b6ec2;
border-color: #1861ac; border-color: #1861ac;
} }
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus { .btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
@@ -17,35 +17,35 @@ a, .btn-link {
} }
.content { .content {
padding-top: 1.1rem; padding-top: 1.1rem;
} }
h1:focus { h1:focus {
outline: none; outline: none;
} }
.valid.modified:not([type=checkbox]) { .valid.modified:not([type=checkbox]) {
outline: 1px solid #26b050; outline: 1px solid #26b050;
} }
.invalid { .invalid {
outline: 1px solid #e50000; outline: 1px solid #e50000;
} }
.validation-message { .validation-message {
color: #e50000; color: #e50000;
} }
.blazor-error-boundary { .blazor-error-boundary {
background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121; background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
padding: 1rem 1rem 1rem 3.7rem; padding: 1rem 1rem 1rem 3.7rem;
color: white; color: white;
} }
.blazor-error-boundary::after { .blazor-error-boundary::after {
content: "An error has occurred." content: "An error has occurred."
} }
.darker-border-checkbox.form-check-input { .darker-border-checkbox.form-check-input {
border-color: #929292; border-color: #929292;
} }