mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 11:14:27 +00:00
Use proper database context in new server.
This commit is contained in:
@@ -11,8 +11,7 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.0"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="6.0.0"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.0"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0"/>
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.0"/>
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.Design" Version="1.1.2"/>
|
||||
|
||||
@@ -7,10 +7,6 @@
|
||||
<UserSecretsId>aspnet-Aaru.Server.New-79282495-4F67-4766-871D-448D1338E8BC</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Data\app.db" CopyToOutputDirectory="PreserveNewest" ExcludeFromSingleFile="true"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Markdig" Version="0.37.0"/>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.4"/>
|
||||
@@ -18,6 +14,9 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.4"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.4"/>
|
||||
<PackageReference Include="WebStoating.Markdig.PrismWithPlugins" Version="1.0.0"/>
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2"/>
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.Design" Version="1.1.2"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.4"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Security.Claims;
|
||||
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.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Http.Extensions;
|
||||
@@ -23,8 +22,8 @@ static class IdentityComponentsEndpointRouteBuilderExtensions
|
||||
RouteGroupBuilder accountGroup = endpoints.MapGroup("/Account");
|
||||
|
||||
accountGroup.MapPost("/PerformExternalLogin",
|
||||
(HttpContext context, [FromServices] SignInManager<ApplicationUser> signInManager,
|
||||
[FromForm] string provider, [FromForm] string returnUrl) =>
|
||||
(HttpContext context, [FromServices] SignInManager<IdentityUser> signInManager,
|
||||
[FromForm] string provider, [FromForm] string returnUrl) =>
|
||||
{
|
||||
IEnumerable<KeyValuePair<string, StringValues>> query =
|
||||
[
|
||||
@@ -44,7 +43,7 @@ static class IdentityComponentsEndpointRouteBuilderExtensions
|
||||
});
|
||||
|
||||
accountGroup.MapPost("/Logout",
|
||||
async (ClaimsPrincipal user, SignInManager<ApplicationUser> signInManager,
|
||||
async (ClaimsPrincipal user, SignInManager<IdentityUser> signInManager,
|
||||
[FromForm] string returnUrl) =>
|
||||
{
|
||||
await signInManager.SignOutAsync();
|
||||
@@ -55,7 +54,7 @@ static class IdentityComponentsEndpointRouteBuilderExtensions
|
||||
RouteGroupBuilder manageGroup = accountGroup.MapGroup("/Manage").RequireAuthorization();
|
||||
|
||||
manageGroup.MapPost("/LinkExternalLogin",
|
||||
async (HttpContext context, [FromServices] SignInManager<ApplicationUser> signInManager,
|
||||
async (HttpContext context, [FromServices] SignInManager<IdentityUser> signInManager,
|
||||
[FromForm] string provider) =>
|
||||
{
|
||||
// Clear the existing external cookie to ensure a clean login process
|
||||
@@ -79,10 +78,10 @@ static class IdentityComponentsEndpointRouteBuilderExtensions
|
||||
ILogger downloadLogger = loggerFactory.CreateLogger("DownloadPersonalData");
|
||||
|
||||
manageGroup.MapPost("/DownloadPersonalData",
|
||||
async (HttpContext context, [FromServices] UserManager<ApplicationUser> userManager,
|
||||
async (HttpContext context, [FromServices] UserManager<IdentityUser> userManager,
|
||||
[FromServices] AuthenticationStateProvider authenticationStateProvider) =>
|
||||
{
|
||||
ApplicationUser? user = await userManager.GetUserAsync(context.User);
|
||||
IdentityUser? user = await userManager.GetUserAsync(context.User);
|
||||
|
||||
if(user is null)
|
||||
{
|
||||
@@ -99,7 +98,7 @@ static class IdentityComponentsEndpointRouteBuilderExtensions
|
||||
// Only include personal data for download
|
||||
var personalData = new Dictionary<string, string>();
|
||||
|
||||
IEnumerable<PropertyInfo> personalDataProps = typeof(ApplicationUser).GetProperties()
|
||||
IEnumerable<PropertyInfo> personalDataProps = typeof(IdentityUser).GetProperties()
|
||||
.Where(prop => Attribute.IsDefined(prop, typeof(PersonalDataAttribute)));
|
||||
|
||||
foreach(PropertyInfo p in personalDataProps)
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
using Aaru.Server.New.Data;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Identity.UI.Services;
|
||||
|
||||
namespace Aaru.Server.New.Components.Account;
|
||||
|
||||
// Remove the "else if (EmailSender is IdentityNoOpEmailSender)" block from RegisterConfirmation.razor after updating with a real implementation.
|
||||
sealed class IdentityNoOpEmailSender : IEmailSender<ApplicationUser>
|
||||
sealed class IdentityNoOpEmailSender : IEmailSender<IdentityUser>
|
||||
{
|
||||
readonly IEmailSender emailSender = new NoOpEmailSender();
|
||||
|
||||
public Task SendConfirmationLinkAsync(ApplicationUser user, string email, string confirmationLink) =>
|
||||
public Task SendConfirmationLinkAsync(IdentityUser user, string email, string confirmationLink) =>
|
||||
emailSender.SendEmailAsync(email,
|
||||
"Confirm your email",
|
||||
$"Please confirm your account by <a href='{confirmationLink}'>clicking here</a>.");
|
||||
|
||||
public Task SendPasswordResetLinkAsync(ApplicationUser user, string email, string resetLink) =>
|
||||
public Task SendPasswordResetLinkAsync(IdentityUser user, string email, string resetLink) =>
|
||||
emailSender.SendEmailAsync(email,
|
||||
"Reset your password",
|
||||
$"Please reset your password by <a href='{resetLink}'>clicking here</a>.");
|
||||
|
||||
public Task SendPasswordResetCodeAsync(ApplicationUser user, string email, string resetCode) =>
|
||||
public Task SendPasswordResetCodeAsync(IdentityUser user, string email, string resetCode) =>
|
||||
emailSender.SendEmailAsync(email,
|
||||
"Reset your password",
|
||||
$"Please reset your password using the following code: {resetCode}");
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Security.Claims;
|
||||
using Aaru.Server.New.Data;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Server;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
@@ -21,15 +20,14 @@ sealed class IdentityRevalidatingAuthenticationStateProvider
|
||||
// Get the user manager from a new scope to ensure it fetches fresh data
|
||||
await using AsyncServiceScope scope = scopeFactory.CreateAsyncScope();
|
||||
|
||||
UserManager<ApplicationUser> userManager =
|
||||
scope.ServiceProvider.GetRequiredService<UserManager<ApplicationUser>>();
|
||||
UserManager<IdentityUser> userManager = scope.ServiceProvider.GetRequiredService<UserManager<IdentityUser>>();
|
||||
|
||||
return await ValidateSecurityStampAsync(userManager, authenticationState.User);
|
||||
}
|
||||
|
||||
async Task<bool> ValidateSecurityStampAsync(UserManager<ApplicationUser> userManager, ClaimsPrincipal principal)
|
||||
async Task<bool> ValidateSecurityStampAsync(UserManager<IdentityUser> userManager, ClaimsPrincipal principal)
|
||||
{
|
||||
ApplicationUser? user = await userManager.GetUserAsync(principal);
|
||||
IdentityUser? user = await userManager.GetUserAsync(principal);
|
||||
|
||||
if(user is null) return false;
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
using Aaru.Server.New.Data;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace Aaru.Server.New.Components.Account;
|
||||
|
||||
sealed class IdentityUserAccessor(UserManager<ApplicationUser> userManager, IdentityRedirectManager redirectManager)
|
||||
sealed class IdentityUserAccessor(UserManager<IdentityUser> userManager, IdentityRedirectManager redirectManager)
|
||||
{
|
||||
public async Task<ApplicationUser> GetRequiredUserAsync(HttpContext context)
|
||||
public async Task<IdentityUser> GetRequiredUserAsync(HttpContext context)
|
||||
{
|
||||
ApplicationUser? user = await userManager.GetUserAsync(context.User);
|
||||
IdentityUser? user = await userManager.GetUserAsync(context.User);
|
||||
|
||||
if(user is null)
|
||||
{
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
@page "/Account/ConfirmEmail"
|
||||
@using System.Text
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@using Microsoft.AspNetCore.WebUtilities
|
||||
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
|
||||
<PageTitle>Confirm email</PageTitle>
|
||||
|
||||
@@ -31,7 +30,7 @@
|
||||
RedirectManager.RedirectTo("");
|
||||
}
|
||||
|
||||
ApplicationUser? user = await UserManager.FindByIdAsync(UserId);
|
||||
IdentityUser? user = await UserManager.FindByIdAsync(UserId);
|
||||
|
||||
if(user is null)
|
||||
{
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
@page "/Account/ConfirmEmailChange"
|
||||
@using System.Text
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@using Microsoft.AspNetCore.WebUtilities
|
||||
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
@inject SignInManager<IdentityUser> SignInManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
|
||||
<PageTitle>Confirm email change</PageTitle>
|
||||
|
||||
@@ -36,7 +35,7 @@
|
||||
RedirectManager.RedirectToWithStatus("Account/Login", "Error: Invalid email change confirmation link.", HttpContext);
|
||||
}
|
||||
|
||||
ApplicationUser? user = await UserManager.FindByIdAsync(UserId);
|
||||
IdentityUser? user = await UserManager.FindByIdAsync(UserId);
|
||||
|
||||
if(user is null)
|
||||
{
|
||||
|
||||
@@ -3,17 +3,16 @@
|
||||
@using System.Security.Claims
|
||||
@using System.Text
|
||||
@using System.Text.Encodings.Web
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@using Microsoft.AspNetCore.WebUtilities
|
||||
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject IUserStore<ApplicationUser> UserStore
|
||||
@inject IEmailSender<ApplicationUser> EmailSender
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject ILogger<ExternalLogin> Logger
|
||||
@inject SignInManager<IdentityUser> SignInManager
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
@inject IUserStore<IdentityUser> UserStore
|
||||
@inject IEmailSender<IdentityUser> EmailSender
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject ILogger<ExternalLogin> Logger
|
||||
|
||||
<PageTitle>Register</PageTitle>
|
||||
|
||||
@@ -121,8 +120,8 @@
|
||||
|
||||
private async Task OnValidSubmitAsync()
|
||||
{
|
||||
IUserEmailStore<ApplicationUser> emailStore = GetEmailStore();
|
||||
ApplicationUser user = CreateUser();
|
||||
IUserEmailStore<IdentityUser> emailStore = GetEmailStore();
|
||||
IdentityUser user = CreateUser();
|
||||
|
||||
await UserStore.SetUserNameAsync(user, Input.Email, CancellationToken.None);
|
||||
await emailStore.SetEmailAsync(user, Input.Email, CancellationToken.None);
|
||||
@@ -168,26 +167,26 @@
|
||||
message = $"Error: {string.Join(",", result.Errors.Select(error => error.Description))}";
|
||||
}
|
||||
|
||||
private ApplicationUser CreateUser()
|
||||
private IdentityUser CreateUser()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Activator.CreateInstance<ApplicationUser>();
|
||||
return Activator.CreateInstance<IdentityUser>();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw new InvalidOperationException($"Can't create an instance of '{nameof(ApplicationUser)}'. " + $"Ensure that '{nameof(ApplicationUser)}' is not an abstract class and has a parameterless constructor");
|
||||
throw new InvalidOperationException($"Can't create an instance of '{nameof(IdentityUser)}'. " + $"Ensure that '{nameof(IdentityUser)}' is not an abstract class and has a parameterless constructor");
|
||||
}
|
||||
}
|
||||
|
||||
private IUserEmailStore<ApplicationUser> GetEmailStore()
|
||||
private IUserEmailStore<IdentityUser> GetEmailStore()
|
||||
{
|
||||
if(!UserManager.SupportsUserEmail)
|
||||
{
|
||||
throw new NotSupportedException("The default UI requires a user store with email support.");
|
||||
}
|
||||
|
||||
return (IUserEmailStore<ApplicationUser>)UserStore;
|
||||
return (IUserEmailStore<IdentityUser>)UserStore;
|
||||
}
|
||||
|
||||
private sealed class InputModel
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
@using System.Text
|
||||
@using System.Text.Encodings.Web
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@using Microsoft.AspNetCore.WebUtilities
|
||||
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject IEmailSender<ApplicationUser> EmailSender
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
@inject IEmailSender<IdentityUser> EmailSender
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
|
||||
<PageTitle>Forgot your password?</PageTitle>
|
||||
|
||||
@@ -38,7 +37,7 @@
|
||||
|
||||
private async Task OnValidSubmitAsync()
|
||||
{
|
||||
ApplicationUser? user = await UserManager.FindByEmailAsync(Input.Email);
|
||||
IdentityUser? user = await UserManager.FindByEmailAsync(Input.Email);
|
||||
|
||||
if(user is null || !await UserManager.IsEmailConfirmedAsync(user))
|
||||
{
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
@page "/Account/Login"
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Authentication
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
@inject ILogger<Login> Logger
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject SignInManager<IdentityUser> SignInManager
|
||||
@inject ILogger<Login> Logger
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
|
||||
<PageTitle>Log in</PageTitle>
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
@page "/Account/LoginWith2fa"
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject ILogger<LoginWith2fa> Logger
|
||||
@inject SignInManager<IdentityUser> SignInManager
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject ILogger<LoginWith2fa> Logger
|
||||
|
||||
<PageTitle>Two-factor authentication</PageTitle>
|
||||
|
||||
@@ -44,8 +43,8 @@
|
||||
</p>
|
||||
|
||||
@code {
|
||||
private string? message;
|
||||
private ApplicationUser user = default!;
|
||||
private string? message;
|
||||
private IdentityUser user = default!;
|
||||
|
||||
[SupplyParameterFromForm]
|
||||
private InputModel Input { get; set; } = new();
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
@page "/Account/LoginWithRecoveryCode"
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject SignInManager<IdentityUser> SignInManager
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject ILogger<LoginWithRecoveryCode> Logger
|
||||
|
||||
@@ -33,8 +32,8 @@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private string? message;
|
||||
private ApplicationUser user = default!;
|
||||
private string? message;
|
||||
private IdentityUser user = default!;
|
||||
|
||||
[SupplyParameterFromForm]
|
||||
private InputModel Input { get; set; } = new();
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
@page "/Account/Manage/ChangePassword"
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
@inject IdentityUserAccessor UserAccessor
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject ILogger<ChangePassword> Logger
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
@inject SignInManager<IdentityUser> SignInManager
|
||||
@inject IdentityUserAccessor UserAccessor
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject ILogger<ChangePassword> Logger
|
||||
|
||||
<PageTitle>Change password</PageTitle>
|
||||
|
||||
@@ -39,9 +38,9 @@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private string? message;
|
||||
private ApplicationUser user = default!;
|
||||
private bool hasPassword;
|
||||
private string? message;
|
||||
private IdentityUser user = default!;
|
||||
private bool hasPassword;
|
||||
|
||||
[CascadingParameter]
|
||||
private HttpContext HttpContext { get; set; } = default!;
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
@page "/Account/Manage/DeletePersonalData"
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
@inject IdentityUserAccessor UserAccessor
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject ILogger<DeletePersonalData> Logger
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
@inject SignInManager<IdentityUser> SignInManager
|
||||
@inject IdentityUserAccessor UserAccessor
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject ILogger<DeletePersonalData> Logger
|
||||
|
||||
<PageTitle>Delete Personal Data</PageTitle>
|
||||
|
||||
@@ -38,9 +37,9 @@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private string? message;
|
||||
private ApplicationUser user = default!;
|
||||
private bool requirePassword;
|
||||
private string? message;
|
||||
private IdentityUser user = default!;
|
||||
private bool requirePassword;
|
||||
|
||||
[CascadingParameter]
|
||||
private HttpContext HttpContext { get; set; } = default!;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
@page "/Account/Manage/Disable2fa"
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject IdentityUserAccessor UserAccessor
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject ILogger<Disable2fa> Logger
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
@inject IdentityUserAccessor UserAccessor
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject ILogger<Disable2fa> Logger
|
||||
|
||||
<PageTitle>Disable two-factor authentication (2FA)</PageTitle>
|
||||
|
||||
@@ -30,7 +29,7 @@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private ApplicationUser user = default!;
|
||||
private IdentityUser user = default!;
|
||||
|
||||
[CascadingParameter]
|
||||
private HttpContext HttpContext { get; set; } = default!;
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
@using System.Text
|
||||
@using System.Text.Encodings.Web
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@using Microsoft.AspNetCore.WebUtilities
|
||||
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject IEmailSender<ApplicationUser> EmailSender
|
||||
@inject IdentityUserAccessor UserAccessor
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
@inject IEmailSender<IdentityUser> EmailSender
|
||||
@inject IdentityUserAccessor UserAccessor
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<PageTitle>Manage email</PageTitle>
|
||||
|
||||
@@ -53,10 +52,10 @@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private string? message;
|
||||
private ApplicationUser user = default!;
|
||||
private string? email;
|
||||
private bool isEmailConfirmed;
|
||||
private string? message;
|
||||
private IdentityUser user = default!;
|
||||
private string? email;
|
||||
private bool isEmailConfirmed;
|
||||
|
||||
[CascadingParameter]
|
||||
private HttpContext HttpContext { get; set; } = default!;
|
||||
|
||||
@@ -3,10 +3,9 @@
|
||||
@using System.Globalization
|
||||
@using System.Text
|
||||
@using System.Text.Encodings.Web
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
@inject IdentityUserAccessor UserAccessor
|
||||
@inject UrlEncoder UrlEncoder
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@@ -70,7 +69,7 @@ else
|
||||
private const string AuthenticatorUriFormat = "otpauth://totp/{0}:{1}?secret={2}&issuer={0}&digits=6";
|
||||
|
||||
private string? message;
|
||||
private ApplicationUser user = default!;
|
||||
private IdentityUser user = default!;
|
||||
private string? sharedKey;
|
||||
private string? authenticatorUri;
|
||||
private IEnumerable<string>? recoveryCodes;
|
||||
@@ -118,7 +117,7 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
private async ValueTask LoadSharedKeyAndQrCodeUriAsync(ApplicationUser user)
|
||||
private async ValueTask LoadSharedKeyAndQrCodeUriAsync(IdentityUser user)
|
||||
{
|
||||
// Load the authenticator key & QR code URI to display on the form
|
||||
string? unformattedKey = await UserManager.GetAuthenticatorKeyAsync(user);
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
@page "/Account/Manage/ExternalLogins"
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Authentication
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
@inject IdentityUserAccessor UserAccessor
|
||||
@inject IUserStore<ApplicationUser> UserStore
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
@inject SignInManager<IdentityUser> SignInManager
|
||||
@inject IdentityUserAccessor UserAccessor
|
||||
@inject IUserStore<IdentityUser> UserStore
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
|
||||
<PageTitle>Manage your external logins</PageTitle>
|
||||
|
||||
@@ -65,7 +64,7 @@
|
||||
@code {
|
||||
public const string LinkLoginCallbackAction = "LinkLoginCallback";
|
||||
|
||||
private ApplicationUser user = default!;
|
||||
private IdentityUser user = default!;
|
||||
private IList<UserLoginInfo>? currentLogins;
|
||||
private IList<AuthenticationScheme>? otherLogins;
|
||||
private bool showRemoveButton;
|
||||
@@ -90,7 +89,7 @@
|
||||
|
||||
string? passwordHash = null;
|
||||
|
||||
if(UserStore is IUserPasswordStore<ApplicationUser> userPasswordStore)
|
||||
if(UserStore is IUserPasswordStore<IdentityUser> userPasswordStore)
|
||||
{
|
||||
passwordHash = await userPasswordStore.GetPasswordHashAsync(user, HttpContext.RequestAborted);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
@page "/Account/Manage/GenerateRecoveryCodes"
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
@inject IdentityUserAccessor UserAccessor
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject ILogger<GenerateRecoveryCodes> Logger
|
||||
@@ -39,7 +38,7 @@ else
|
||||
|
||||
@code {
|
||||
private string? message;
|
||||
private ApplicationUser user = default!;
|
||||
private IdentityUser user = default!;
|
||||
private IEnumerable<string>? recoveryCodes;
|
||||
|
||||
[CascadingParameter]
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
@page "/Account/Manage"
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
@inject IdentityUserAccessor UserAccessor
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
@inject SignInManager<IdentityUser> SignInManager
|
||||
@inject IdentityUserAccessor UserAccessor
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
|
||||
<PageTitle>Profile</PageTitle>
|
||||
|
||||
@@ -33,9 +32,9 @@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private ApplicationUser user = default!;
|
||||
private string? username;
|
||||
private string? phoneNumber;
|
||||
private IdentityUser user = default!;
|
||||
private string? username;
|
||||
private string? phoneNumber;
|
||||
|
||||
[CascadingParameter]
|
||||
private HttpContext HttpContext { get; set; } = default!;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
@page "/Account/Manage/ResetAuthenticator"
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
@inject IdentityUserAccessor UserAccessor
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject ILogger<ResetAuthenticator> Logger
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
@inject SignInManager<IdentityUser> SignInManager
|
||||
@inject IdentityUserAccessor UserAccessor
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject ILogger<ResetAuthenticator> Logger
|
||||
|
||||
<PageTitle>Reset authenticator key</PageTitle>
|
||||
|
||||
@@ -35,7 +34,7 @@
|
||||
|
||||
private async Task OnSubmitAsync()
|
||||
{
|
||||
ApplicationUser user = await UserAccessor.GetRequiredUserAsync(HttpContext);
|
||||
IdentityUser user = await UserAccessor.GetRequiredUserAsync(HttpContext);
|
||||
await UserManager.SetTwoFactorEnabledAsync(user, false);
|
||||
await UserManager.ResetAuthenticatorKeyAsync(user);
|
||||
string userId = await UserManager.GetUserIdAsync(user);
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
@page "/Account/Manage/SetPassword"
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
@inject IdentityUserAccessor UserAccessor
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
@inject SignInManager<IdentityUser> SignInManager
|
||||
@inject IdentityUserAccessor UserAccessor
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
|
||||
<PageTitle>Set password</PageTitle>
|
||||
|
||||
@@ -37,8 +36,8 @@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private string? message;
|
||||
private ApplicationUser user = default!;
|
||||
private string? message;
|
||||
private IdentityUser user = default!;
|
||||
|
||||
[CascadingParameter]
|
||||
private HttpContext HttpContext { get; set; } = default!;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
@page "/Account/Manage/TwoFactorAuthentication"
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Http.Features
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
@inject IdentityUserAccessor UserAccessor
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
@inject SignInManager<IdentityUser> SignInManager
|
||||
@inject IdentityUserAccessor UserAccessor
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
|
||||
<PageTitle>Two-factor authentication (2FA)</PageTitle>
|
||||
|
||||
@@ -82,7 +81,7 @@ else
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ApplicationUser user = await UserAccessor.GetRequiredUserAsync(HttpContext);
|
||||
IdentityUser user = await UserAccessor.GetRequiredUserAsync(HttpContext);
|
||||
canTrack = HttpContext.Features.Get<ITrackingConsentFeature>()?.CanTrack ?? true;
|
||||
hasAuthenticator = await UserManager.GetAuthenticatorKeyAsync(user) is not null;
|
||||
is2faEnabled = await UserManager.GetTwoFactorEnabledAsync(user);
|
||||
|
||||
@@ -2,17 +2,16 @@
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
@using System.Text
|
||||
@using System.Text.Encodings.Web
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@using Microsoft.AspNetCore.WebUtilities
|
||||
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject IUserStore<ApplicationUser> UserStore
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
@inject IEmailSender<ApplicationUser> EmailSender
|
||||
@inject ILogger<Register> Logger
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
@inject IUserStore<IdentityUser> UserStore
|
||||
@inject SignInManager<IdentityUser> SignInManager
|
||||
@inject IEmailSender<IdentityUser> EmailSender
|
||||
@inject ILogger<Register> Logger
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
|
||||
<PageTitle>Register</PageTitle>
|
||||
|
||||
@@ -66,10 +65,10 @@
|
||||
|
||||
public async Task RegisterUser(EditContext editContext)
|
||||
{
|
||||
ApplicationUser user = CreateUser();
|
||||
IdentityUser user = CreateUser();
|
||||
|
||||
await UserStore.SetUserNameAsync(user, Input.Email, CancellationToken.None);
|
||||
IUserEmailStore<ApplicationUser> emailStore = GetEmailStore();
|
||||
IUserEmailStore<IdentityUser> emailStore = GetEmailStore();
|
||||
await emailStore.SetEmailAsync(user, Input.Email, CancellationToken.None);
|
||||
IdentityResult result = await UserManager.CreateAsync(user, Input.Password);
|
||||
|
||||
@@ -110,26 +109,26 @@
|
||||
RedirectManager.RedirectTo(ReturnUrl);
|
||||
}
|
||||
|
||||
private ApplicationUser CreateUser()
|
||||
private IdentityUser CreateUser()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Activator.CreateInstance<ApplicationUser>();
|
||||
return Activator.CreateInstance<IdentityUser>();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw new InvalidOperationException($"Can't create an instance of '{nameof(ApplicationUser)}'. " + $"Ensure that '{nameof(ApplicationUser)}' is not an abstract class and has a parameterless constructor.");
|
||||
throw new InvalidOperationException($"Can't create an instance of '{nameof(IdentityUser)}'. " + $"Ensure that '{nameof(IdentityUser)}' is not an abstract class and has a parameterless constructor.");
|
||||
}
|
||||
}
|
||||
|
||||
private IUserEmailStore<ApplicationUser> GetEmailStore()
|
||||
private IUserEmailStore<IdentityUser> GetEmailStore()
|
||||
{
|
||||
if(!UserManager.SupportsUserEmail)
|
||||
{
|
||||
throw new NotSupportedException("The default UI requires a user store with email support.");
|
||||
}
|
||||
|
||||
return (IUserEmailStore<ApplicationUser>)UserStore;
|
||||
return (IUserEmailStore<IdentityUser>)UserStore;
|
||||
}
|
||||
|
||||
private sealed class InputModel
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
@page "/Account/RegisterConfirmation"
|
||||
@using System.Text
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@using Microsoft.AspNetCore.WebUtilities
|
||||
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject IEmailSender<ApplicationUser> EmailSender
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
@inject IEmailSender<IdentityUser> EmailSender
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
|
||||
<PageTitle>Register confirmation</PageTitle>
|
||||
|
||||
@@ -47,7 +46,7 @@ else
|
||||
RedirectManager.RedirectTo("");
|
||||
}
|
||||
|
||||
ApplicationUser? user = await UserManager.FindByEmailAsync(Email);
|
||||
IdentityUser? user = await UserManager.FindByEmailAsync(Email);
|
||||
|
||||
if(user is null)
|
||||
{
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
@using System.Text
|
||||
@using System.Text.Encodings.Web
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@using Microsoft.AspNetCore.WebUtilities
|
||||
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject IEmailSender<ApplicationUser> EmailSender
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
@inject IEmailSender<IdentityUser> EmailSender
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
|
||||
<PageTitle>Resend email confirmation</PageTitle>
|
||||
|
||||
@@ -40,7 +39,7 @@
|
||||
|
||||
private async Task OnValidSubmitAsync()
|
||||
{
|
||||
ApplicationUser? user = await UserManager.FindByEmailAsync(Input.Email!);
|
||||
IdentityUser? user = await UserManager.FindByEmailAsync(Input.Email!);
|
||||
|
||||
if(user is null)
|
||||
{
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
@page "/Account/ResetPassword"
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
@using System.Text
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@using Microsoft.AspNetCore.WebUtilities
|
||||
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject UserManager<IdentityUser> UserManager
|
||||
|
||||
<PageTitle>Reset password</PageTitle>
|
||||
|
||||
@@ -64,7 +63,7 @@
|
||||
|
||||
private async Task OnValidSubmitAsync()
|
||||
{
|
||||
ApplicationUser? user = await UserManager.FindByEmailAsync(Input.Email);
|
||||
IdentityUser? user = await UserManager.FindByEmailAsync(Input.Email);
|
||||
|
||||
if(user is null)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Authentication
|
||||
@using Microsoft.AspNetCore.Authentication
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
@inject SignInManager<IdentityUser> SignInManager
|
||||
@inject IdentityRedirectManager RedirectManager
|
||||
|
||||
@if(externalLogins.Length == 0)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
@using Aaru.Server.New.Data
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@inject SignInManager<IdentityUser> SignInManager
|
||||
|
||||
<ul class="flex-column nav nav-pills">
|
||||
<li class="nav-item">
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Aaru.Server.New.Data;
|
||||
|
||||
public class ApplicationDbContext
|
||||
(DbContextOptions<ApplicationDbContext> options) : IdentityDbContext<ApplicationUser>(options) {}
|
||||
@@ -1,6 +0,0 @@
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace Aaru.Server.New.Data;
|
||||
|
||||
// Add profile data for application users by adding properties to the ApplicationUser class
|
||||
public class ApplicationUser : IdentityUser {}
|
||||
@@ -1,226 +0,0 @@
|
||||
// <auto-generated />
|
||||
|
||||
using System;
|
||||
using Aaru.Server.New.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Aaru.Server.New.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[Migration("00000000000000_CreateIdentitySchema")]
|
||||
partial class CreateIdentitySchema
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.0");
|
||||
|
||||
modelBuilder.Entity("Aaru.Server.New.Data.ApplicationUser",
|
||||
b =>
|
||||
{
|
||||
b.Property<string>("Id").HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("AccessFailedCount").HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp").IsConcurrencyToken().HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Email").HasMaxLength(256).HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("EmailConfirmed").HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("LockoutEnabled").HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("NormalizedEmail").HasMaxLength(256).HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("NormalizedUserName").HasMaxLength(256).HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("PasswordHash").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("PhoneNumber").HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed").HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("SecurityStamp").HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled").HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("UserName").HasMaxLength(256).HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail").HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName").IsUnique().HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.ToTable("AspNetUsers", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole",
|
||||
b =>
|
||||
{
|
||||
b.Property<string>("Id").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp").IsConcurrencyToken().HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name").HasMaxLength(256).HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("NormalizedName").HasMaxLength(256).HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName").IsUnique().HasDatabaseName("RoleNameIndex");
|
||||
|
||||
b.ToTable("AspNetRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>",
|
||||
b =>
|
||||
{
|
||||
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ClaimType").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ClaimValue").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("RoleId").IsRequired().HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>",
|
||||
b =>
|
||||
{
|
||||
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ClaimType").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ClaimValue").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("UserId").IsRequired().HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>",
|
||||
b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ProviderKey").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ProviderDisplayName").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("UserId").IsRequired().HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>",
|
||||
b =>
|
||||
{
|
||||
b.Property<string>("UserId").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("RoleId").HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>",
|
||||
b =>
|
||||
{
|
||||
b.Property<string>("UserId").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("LoginProvider").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Value").HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>",
|
||||
b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>",
|
||||
b =>
|
||||
{
|
||||
b.HasOne("Aaru.Server.New.Data.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>",
|
||||
b =>
|
||||
{
|
||||
b.HasOne("Aaru.Server.New.Data.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>",
|
||||
b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Aaru.Server.New.Data.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>",
|
||||
b =>
|
||||
{
|
||||
b.HasOne("Aaru.Server.New.Data.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,212 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Aaru.Server.New.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class CreateIdentitySchema : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(name: "AspNetRoles",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Name = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
|
||||
NormalizedName =
|
||||
table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
|
||||
ConcurrencyStamp = table.Column<string>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table => { table.PrimaryKey("PK_AspNetRoles", x => x.Id); });
|
||||
|
||||
migrationBuilder.CreateTable(name: "AspNetUsers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "TEXT", nullable: false),
|
||||
UserName =
|
||||
table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
|
||||
NormalizedUserName =
|
||||
table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
|
||||
Email = table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
|
||||
NormalizedEmail =
|
||||
table.Column<string>(type: "TEXT", maxLength: 256, nullable: true),
|
||||
EmailConfirmed = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
PasswordHash = table.Column<string>(type: "TEXT", nullable: true),
|
||||
SecurityStamp = table.Column<string>(type: "TEXT", nullable: true),
|
||||
ConcurrencyStamp = table.Column<string>(type: "TEXT", nullable: true),
|
||||
PhoneNumber = table.Column<string>(type: "TEXT", nullable: true),
|
||||
PhoneNumberConfirmed =
|
||||
table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
TwoFactorEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
LockoutEnd = table.Column<DateTimeOffset>(type: "TEXT", nullable: true),
|
||||
LockoutEnabled = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
AccessFailedCount = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table => { table.PrimaryKey("PK_AspNetUsers", x => x.Id); });
|
||||
|
||||
migrationBuilder.CreateTable(name: "AspNetRoleClaims",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
RoleId = table.Column<string>(type: "TEXT", nullable: false),
|
||||
ClaimType = table.Column<string>(type: "TEXT", nullable: true),
|
||||
ClaimValue = table.Column<string>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
|
||||
|
||||
table.ForeignKey(name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalTable: "AspNetRoles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(name: "AspNetUserClaims",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
UserId = table.Column<string>(type: "TEXT", nullable: false),
|
||||
ClaimType = table.Column<string>(type: "TEXT", nullable: true),
|
||||
ClaimValue = table.Column<string>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
|
||||
|
||||
table.ForeignKey(name: "FK_AspNetUserClaims_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(name: "AspNetUserLogins",
|
||||
columns: table => new
|
||||
{
|
||||
LoginProvider = table.Column<string>(type: "TEXT", nullable: false),
|
||||
ProviderKey = table.Column<string>(type: "TEXT", nullable: false),
|
||||
ProviderDisplayName = table.Column<string>(type: "TEXT", nullable: true),
|
||||
UserId = table.Column<string>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserLogins",
|
||||
x => new
|
||||
{
|
||||
x.LoginProvider,
|
||||
x.ProviderKey
|
||||
});
|
||||
|
||||
table.ForeignKey(name: "FK_AspNetUserLogins_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(name: "AspNetUserRoles",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<string>(type: "TEXT", nullable: false),
|
||||
RoleId = table.Column<string>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserRoles",
|
||||
x => new
|
||||
{
|
||||
x.UserId,
|
||||
x.RoleId
|
||||
});
|
||||
|
||||
table.ForeignKey(name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
|
||||
column: x => x.RoleId,
|
||||
principalTable: "AspNetRoles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
table.ForeignKey(name: "FK_AspNetUserRoles_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(name: "AspNetUserTokens",
|
||||
columns: table => new
|
||||
{
|
||||
UserId = table.Column<string>(type: "TEXT", nullable: false),
|
||||
LoginProvider = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Name = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Value = table.Column<string>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AspNetUserTokens",
|
||||
x => new
|
||||
{
|
||||
x.UserId,
|
||||
x.LoginProvider,
|
||||
x.Name
|
||||
});
|
||||
|
||||
table.ForeignKey(name: "FK_AspNetUserTokens_AspNetUsers_UserId",
|
||||
column: x => x.UserId,
|
||||
principalTable: "AspNetUsers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(name: "IX_AspNetRoleClaims_RoleId",
|
||||
table: "AspNetRoleClaims",
|
||||
column: "RoleId");
|
||||
|
||||
migrationBuilder.CreateIndex(name: "RoleNameIndex",
|
||||
table: "AspNetRoles",
|
||||
column: "NormalizedName",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(name: "IX_AspNetUserClaims_UserId",
|
||||
table: "AspNetUserClaims",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(name: "IX_AspNetUserLogins_UserId",
|
||||
table: "AspNetUserLogins",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(name: "IX_AspNetUserRoles_RoleId", table: "AspNetUserRoles", column: "RoleId");
|
||||
|
||||
migrationBuilder.CreateIndex(name: "EmailIndex", table: "AspNetUsers", column: "NormalizedEmail");
|
||||
|
||||
migrationBuilder.CreateIndex(name: "UserNameIndex",
|
||||
table: "AspNetUsers",
|
||||
column: "NormalizedUserName",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(name: "AspNetRoleClaims");
|
||||
|
||||
migrationBuilder.DropTable(name: "AspNetUserClaims");
|
||||
|
||||
migrationBuilder.DropTable(name: "AspNetUserLogins");
|
||||
|
||||
migrationBuilder.DropTable(name: "AspNetUserRoles");
|
||||
|
||||
migrationBuilder.DropTable(name: "AspNetUserTokens");
|
||||
|
||||
migrationBuilder.DropTable(name: "AspNetRoles");
|
||||
|
||||
migrationBuilder.DropTable(name: "AspNetUsers");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,223 +0,0 @@
|
||||
// <auto-generated />
|
||||
|
||||
using System;
|
||||
using Aaru.Server.New.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Aaru.Server.New.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
partial class ApplicationDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.0");
|
||||
|
||||
modelBuilder.Entity("Aaru.Server.New.Data.ApplicationUser",
|
||||
b =>
|
||||
{
|
||||
b.Property<string>("Id").HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("AccessFailedCount").HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp").IsConcurrencyToken().HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Email").HasMaxLength(256).HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("EmailConfirmed").HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("LockoutEnabled").HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("NormalizedEmail").HasMaxLength(256).HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("NormalizedUserName").HasMaxLength(256).HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("PasswordHash").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("PhoneNumber").HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed").HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("SecurityStamp").HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled").HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("UserName").HasMaxLength(256).HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail").HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName").IsUnique().HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.ToTable("AspNetUsers", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole",
|
||||
b =>
|
||||
{
|
||||
b.Property<string>("Id").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp").IsConcurrencyToken().HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name").HasMaxLength(256).HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("NormalizedName").HasMaxLength(256).HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName").IsUnique().HasDatabaseName("RoleNameIndex");
|
||||
|
||||
b.ToTable("AspNetRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>",
|
||||
b =>
|
||||
{
|
||||
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ClaimType").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ClaimValue").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("RoleId").IsRequired().HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>",
|
||||
b =>
|
||||
{
|
||||
b.Property<int>("Id").ValueGeneratedOnAdd().HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ClaimType").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ClaimValue").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("UserId").IsRequired().HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>",
|
||||
b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ProviderKey").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ProviderDisplayName").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("UserId").IsRequired().HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>",
|
||||
b =>
|
||||
{
|
||||
b.Property<string>("UserId").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("RoleId").HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>",
|
||||
b =>
|
||||
{
|
||||
b.Property<string>("UserId").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("LoginProvider").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name").HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Value").HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>",
|
||||
b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>",
|
||||
b =>
|
||||
{
|
||||
b.HasOne("Aaru.Server.New.Data.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>",
|
||||
b =>
|
||||
{
|
||||
b.HasOne("Aaru.Server.New.Data.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>",
|
||||
b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Aaru.Server.New.Data.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>",
|
||||
b =>
|
||||
{
|
||||
b.HasOne("Aaru.Server.New.Data.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,6 +1,5 @@
|
||||
using Aaru.Server.New.Components;
|
||||
using Aaru.Server.New.Components.Account;
|
||||
using Aaru.Server.New.Data;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -25,15 +24,23 @@ builder.Services.AddAuthentication(options =>
|
||||
string connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ??
|
||||
throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");
|
||||
|
||||
builder.Services.AddDbContext<ApplicationDbContext>(options => options.UseSqlite(connectionString));
|
||||
builder.Services.AddDbContext<DbContext>(options => options
|
||||
.UseMySql(connectionString,
|
||||
new MariaDbServerVersion(new Version(10, 4, 0)))
|
||||
.UseLazyLoadingProxies());
|
||||
|
||||
builder.Services.AddDatabaseDeveloperPageExceptionFilter();
|
||||
|
||||
builder.Services.AddIdentityCore<ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true)
|
||||
.AddEntityFrameworkStores<ApplicationDbContext>()
|
||||
builder.Services.AddIdentityCore<IdentityUser>(options =>
|
||||
{
|
||||
options.SignIn.RequireConfirmedAccount = true;
|
||||
options.User.RequireUniqueEmail = true;
|
||||
})
|
||||
.AddEntityFrameworkStores<DbContext>()
|
||||
.AddSignInManager()
|
||||
.AddDefaultTokenProviders();
|
||||
|
||||
builder.Services.AddSingleton<IEmailSender<ApplicationUser>, IdentityNoOpEmailSender>();
|
||||
builder.Services.AddSingleton<IEmailSender<IdentityUser>, IdentityNoOpEmailSender>();
|
||||
|
||||
WebApplication app = builder.Build();
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "server=mariadb-dev.claunia.com;port=3306;database=discimagechef;uid=dic;password=dicpass"
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
|
||||
Reference in New Issue
Block a user