diff --git a/Pixel.Identity.sln b/Pixel.Identity.sln index 141319a..a6e30e5 100644 --- a/Pixel.Identity.sln +++ b/Pixel.Identity.sln @@ -17,9 +17,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pixel.Identity.Core", "src\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pixel.Identity.Messenger.Email", "src\Pixel.Identity.Messenger.Email\Pixel.Identity.Messenger.Email.csproj", "{E7F60792-6D88-40BB-A4F5-F70CC6B81396}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pixel.Identity.Store.PostgreSQL", "src\Pixel.Identity.Store.PostgreSQL\Pixel.Identity.Store.PostgreSQL.csproj", "{81343846-EC79-486E-930D-613E1B92E313}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pixel.Identity.Store.PostgreSQL", "src\Pixel.Identity.Store.PostgreSQL\Pixel.Identity.Store.PostgreSQL.csproj", "{81343846-EC79-486E-930D-613E1B92E313}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pixel.Identity.Store.Sql.Shared", "src\Pixel.Identity.Store.Sql.Shared\Pixel.Identity.Store.Sql.Shared.csproj", "{F2BB8C99-30D7-4F6E-ABEC-3F218DF60870}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pixel.Identity.Store.Sql.Shared", "src\Pixel.Identity.Store.Sql.Shared\Pixel.Identity.Store.Sql.Shared.csproj", "{F2BB8C99-30D7-4F6E-ABEC-3F218DF60870}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pixel.Identity.Store.SqlServer", "src\Pixel.Identity.Store.SqlServer\Pixel.Identity.Store.SqlServer.csproj", "{E67F20E6-B228-467A-9C40-1B38EAD35367}" EndProject diff --git a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/ConfirmEmail.cshtml b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/ConfirmEmail.cshtml similarity index 100% rename from src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/ConfirmEmail.cshtml rename to src/Pixel.Identity.Core/Areas/Identity/Pages/Account/ConfirmEmail.cshtml diff --git a/src/Pixel.Identity.Core/Pages/ConfirmEmail.cs b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs similarity index 88% rename from src/Pixel.Identity.Core/Pages/ConfirmEmail.cs rename to src/Pixel.Identity.Core/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs index a86221c..dc034b6 100644 --- a/src/Pixel.Identity.Core/Pages/ConfirmEmail.cs +++ b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs @@ -1,18 +1,19 @@ -using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.WebUtilities; using System.Text; -namespace Pixel.Identity.Core.Pages +namespace Pixel.Identity.Core.Areas.Identity.Pages.Account { - [AllowAnonymous] + [AllowAnonymous] + [IdentityDefaultUI(typeof(ConfirmEmailModel<>))] public abstract class ConfirmEmailModel : PageModel - { + { [TempData] public string StatusMessage { get; set; } - + public virtual Task OnGetAsync(string userId, string code) => throw new NotImplementedException(); } diff --git a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/ExternalLogin.cshtml b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/ExternalLogin.cshtml similarity index 100% rename from src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/ExternalLogin.cshtml rename to src/Pixel.Identity.Core/Areas/Identity/Pages/Account/ExternalLogin.cshtml diff --git a/src/Pixel.Identity.Core/Pages/ExternalLogin.cs b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs similarity index 97% rename from src/Pixel.Identity.Core/Pages/ExternalLogin.cs rename to src/Pixel.Identity.Core/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs index 68a9ffe..f79ec2d 100644 --- a/src/Pixel.Identity.Core/Pages/ExternalLogin.cs +++ b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; @@ -8,38 +8,39 @@ using System.Text; using System.Text.Encodings.Web; -namespace Pixel.Identity.Core.Pages +namespace Pixel.Identity.Core.Areas.Identity.Pages.Account { - [AllowAnonymous] + [AllowAnonymous] + [IdentityDefaultUI(typeof(ExternalLoginModel<>))] public class ExternalLoginModel : PageModel - { + { [BindProperty] public InputModel Input { get; set; } - + public string ProviderDisplayName { get; set; } - + public string ReturnUrl { get; set; } [TempData] public string ErrorMessage { get; set; } - + public class InputModel - { + { [Required] [EmailAddress] public string Email { get; set; } } - + public virtual IActionResult OnGet() => throw new NotImplementedException(); - + public virtual IActionResult OnPost(string provider, string returnUrl = null) => throw new NotImplementedException(); public virtual Task OnGetCallbackAsync(string returnUrl = null, string remoteError = null) => throw new NotImplementedException(); - + public virtual Task OnPostConfirmationAsync(string returnUrl = null) => throw new NotImplementedException(); } - public class ExternalLoginModel : ExternalLoginModel where TUser :IdentityUser, new() + public class ExternalLoginModel : ExternalLoginModel where TUser : IdentityUser, new() { private readonly SignInManager signInManager; private readonly UserManager userManager; diff --git a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/Login.cshtml b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/Login.cshtml similarity index 100% rename from src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/Login.cshtml rename to src/Pixel.Identity.Core/Areas/Identity/Pages/Account/Login.cshtml diff --git a/src/Pixel.Identity.Core/Pages/Login.cs b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/Login.cshtml.cs similarity index 92% rename from src/Pixel.Identity.Core/Pages/Login.cs rename to src/Pixel.Identity.Core/Areas/Identity/Pages/Account/Login.cshtml.cs index 7ddd893..1356adb 100644 --- a/src/Pixel.Identity.Core/Pages/Login.cs +++ b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/Login.cshtml.cs @@ -1,42 +1,43 @@ -using Microsoft.AspNetCore.Authentication; +using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using System.ComponentModel.DataAnnotations; -namespace Pixel.Identity.Core.Pages +namespace Pixel.Identity.Core.Areas.Identity.Pages.Account { - [AllowAnonymous] + [AllowAnonymous] + [IdentityDefaultUI(typeof(LoginModel<>))] public abstract class LoginModel : PageModel - { + { [BindProperty] public InputModel Input { get; set; } - + public IList ExternalLogins { get; set; } - + public string ReturnUrl { get; set; } - + [TempData] public string ErrorMessage { get; set; } - + public class InputModel { - + [Required] [EmailAddress] public string Email { get; set; } - + [Required] [DataType(DataType.Password)] public string Password { get; set; } - + [Display(Name = "Remember me?")] public bool RememberMe { get; set; } } - + public virtual Task OnGetAsync(string returnUrl = null) => throw new NotImplementedException(); - + public virtual Task OnPostAsync(string returnUrl = null) => throw new NotImplementedException(); } @@ -80,7 +81,7 @@ public override async Task OnPostAsync(string returnUrl = null) // To enable password failures to trigger account lockout, set lockoutOnFailure: true var result = await _signInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: true); if (result.Succeeded) - { + { return LocalRedirect(returnUrl); } if (result.RequiresTwoFactor) @@ -88,7 +89,7 @@ public override async Task OnPostAsync(string returnUrl = null) return RedirectToPage("./LoginWith2fa", new { ReturnUrl = returnUrl, RememberMe = Input.RememberMe }); } if (result.IsLockedOut) - { + { return RedirectToPage("./Lockout"); } else diff --git a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/LoginWith2fa.cshtml b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/LoginWith2fa.cshtml similarity index 100% rename from src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/LoginWith2fa.cshtml rename to src/Pixel.Identity.Core/Areas/Identity/Pages/Account/LoginWith2fa.cshtml diff --git a/src/Pixel.Identity.Core/Pages/LoginWith2fa.cs b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/LoginWith2fa.cshtml.cs similarity index 92% rename from src/Pixel.Identity.Core/Pages/LoginWith2fa.cs rename to src/Pixel.Identity.Core/Areas/Identity/Pages/Account/LoginWith2fa.cshtml.cs index 12f7731..96783d4 100644 --- a/src/Pixel.Identity.Core/Pages/LoginWith2fa.cs +++ b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/LoginWith2fa.cshtml.cs @@ -1,43 +1,44 @@ -using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using System.ComponentModel.DataAnnotations; -namespace Pixel.Identity.Core.Pages +namespace Pixel.Identity.Core.Areas.Identity.Pages.Account { - [AllowAnonymous] + [AllowAnonymous] + [IdentityDefaultUI(typeof(LoginWith2faModel<>))] public abstract class LoginWith2faModel : PageModel - { + { [BindProperty] public InputModel Input { get; set; } - + public bool RememberMe { get; set; } - + public string ReturnUrl { get; set; } - + public class InputModel - { + { [Required] [StringLength(7, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] [DataType(DataType.Text)] [Display(Name = "Authenticator code")] public string TwoFactorCode { get; set; } - + [Display(Name = "Remember this machine")] public bool RememberMachine { get; set; } } - + public virtual Task OnGetAsync(bool rememberMe, string returnUrl = null) => throw new NotImplementedException(); - + public virtual Task OnPostAsync(bool rememberMe, string returnUrl = null) => throw new NotImplementedException(); } public class LoginWith2faModel : LoginWith2faModel where TUser : IdentityUser, new() { private readonly SignInManager signInManager; - private readonly UserManager userManager; + private readonly UserManager userManager; /// /// constructor @@ -47,7 +48,7 @@ public class InputModel public LoginWith2faModel(SignInManager signInManager, UserManager userManager) { this.signInManager = signInManager; - this.userManager = userManager; + this.userManager = userManager; } public override async Task OnGetAsync(bool rememberMe, string returnUrl = null) diff --git a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml similarity index 100% rename from src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml rename to src/Pixel.Identity.Core/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml diff --git a/src/Pixel.Identity.Core/Pages/LoginWithRecoverCode.cs b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml.cs similarity index 92% rename from src/Pixel.Identity.Core/Pages/LoginWithRecoverCode.cs rename to src/Pixel.Identity.Core/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml.cs index cfc161d..16c11e4 100644 --- a/src/Pixel.Identity.Core/Pages/LoginWithRecoverCode.cs +++ b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml.cs @@ -1,19 +1,20 @@ -using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using System.ComponentModel.DataAnnotations; -namespace Pixel.Identity.Core.Pages -{ - [AllowAnonymous] +namespace Pixel.Identity.Core.Areas.Identity.Pages.Account +{ + [AllowAnonymous] + [IdentityDefaultUI(typeof(LoginWithRecoveryCodeModel<>))] public abstract class LoginWithRecoveryCodeModel : PageModel - { + { [BindProperty] public InputModel Input { get; set; } - + public string ReturnUrl { get; set; } - + public class InputModel { [BindProperty] @@ -22,9 +23,9 @@ public class InputModel [Display(Name = "Recovery Code")] public string RecoveryCode { get; set; } } - + public virtual Task OnGetAsync(string returnUrl = null) => throw new NotImplementedException(); - + public virtual Task OnPostAsync(string returnUrl = null) => throw new NotImplementedException(); } @@ -32,12 +33,12 @@ public class InputModel { private readonly SignInManager signInManager; private readonly UserManager userManager; - + public LoginWithRecoveryCodeModel(SignInManager signInManager, UserManager userManager) { this.signInManager = signInManager; - this.userManager = userManager; + this.userManager = userManager; } public override async Task OnGetAsync(string returnUrl = null) diff --git a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/Register.cshtml b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/Register.cshtml similarity index 100% rename from src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/Register.cshtml rename to src/Pixel.Identity.Core/Areas/Identity/Pages/Account/Register.cshtml diff --git a/src/Pixel.Identity.Core/Pages/Register.cs b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/Register.cshtml.cs similarity index 95% rename from src/Pixel.Identity.Core/Pages/Register.cs rename to src/Pixel.Identity.Core/Areas/Identity/Pages/Account/Register.cshtml.cs index dcd7a28..c0f61f9 100644 --- a/src/Pixel.Identity.Core/Pages/Register.cs +++ b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/Register.cshtml.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Authentication; +using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; @@ -8,37 +8,39 @@ using System.Text; using System.Text.Encodings.Web; -namespace Pixel.Identity.Core.Pages +namespace Pixel.Identity.Core.Areas.Identity.Pages.Account { - [AllowAnonymous] - public abstract class RegisterModel : PageModel { - + [AllowAnonymous] + [IdentityDefaultUI(typeof(RegisterModel<>))] + public abstract class RegisterModel : PageModel + { + [BindProperty] public InputModel Input { get; set; } - + public string ReturnUrl { get; set; } - + public IList ExternalLogins { get; set; } - + public class InputModel - { + { [Required] [EmailAddress] [Display(Name = "Email")] public string Email { get; set; } - + [Required] [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] [DataType(DataType.Password)] [Display(Name = "Password")] public string Password { get; set; } - + [DataType(DataType.Password)] [Display(Name = "Confirm password")] [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] public string ConfirmPassword { get; set; } } - + public virtual Task OnGetAsync(string returnUrl = null) => throw new NotImplementedException(); public virtual Task OnPostAsync(string returnUrl = null) => throw new NotImplementedException(); @@ -86,7 +88,7 @@ public override async Task OnPostAsync(string returnUrl = null) var result = await _userManager.CreateAsync(user, Input.Password); if (result.Succeeded) - { + { var userId = await _userManager.GetUserIdAsync(user); var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code)); diff --git a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml similarity index 100% rename from src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml rename to src/Pixel.Identity.Core/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml diff --git a/src/Pixel.Identity.Core/Pages/RegisterConfirmation.cs b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs similarity index 93% rename from src/Pixel.Identity.Core/Pages/RegisterConfirmation.cs rename to src/Pixel.Identity.Core/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs index 6df4cef..5555aae 100644 --- a/src/Pixel.Identity.Core/Pages/RegisterConfirmation.cs +++ b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs @@ -1,11 +1,12 @@ -using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -namespace Pixel.Identity.Core.Pages +namespace Pixel.Identity.Core.Areas.Identity.Pages.Account { [AllowAnonymous] + [IdentityDefaultUI(typeof(RegisterConfirmationModel<>))] public class RegisterConfirmationModel : PageModel { public string Email { get; set; } diff --git a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/ResetPassword.cshtml b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/ResetPassword.cshtml similarity index 100% rename from src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/ResetPassword.cshtml rename to src/Pixel.Identity.Core/Areas/Identity/Pages/Account/ResetPassword.cshtml diff --git a/src/Pixel.Identity.Core/Pages/ResetPassword.cs b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/ResetPassword.cshtml.cs similarity index 96% rename from src/Pixel.Identity.Core/Pages/ResetPassword.cs rename to src/Pixel.Identity.Core/Areas/Identity/Pages/Account/ResetPassword.cshtml.cs index 5962c47..c62a0b4 100644 --- a/src/Pixel.Identity.Core/Pages/ResetPassword.cs +++ b/src/Pixel.Identity.Core/Areas/Identity/Pages/Account/ResetPassword.cshtml.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; @@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations; using System.Text; -namespace Pixel.Identity.Core.Pages +namespace Pixel.Identity.Core.Areas.Identity.Pages.Account { [AllowAnonymous] public abstract class ResetPasswordModel : PageModel diff --git a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Shared/_StatusMessage.cshtml b/src/Pixel.Identity.Core/Areas/Identity/Pages/Shared/_StatusMessage.cshtml similarity index 100% rename from src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Shared/_StatusMessage.cshtml rename to src/Pixel.Identity.Core/Areas/Identity/Pages/Shared/_StatusMessage.cshtml diff --git a/src/Pixel.Identity.Core/Attributes/IdentityDefaultUIAttribute.cs b/src/Pixel.Identity.Core/Attributes/IdentityDefaultUIAttribute.cs new file mode 100644 index 0000000..ff7549d --- /dev/null +++ b/src/Pixel.Identity.Core/Attributes/IdentityDefaultUIAttribute.cs @@ -0,0 +1,13 @@ +namespace Pixel.Identity.Core +{ + [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] + public sealed class IdentityDefaultUIAttribute : Attribute + { + public IdentityDefaultUIAttribute(Type implementationTemplate) + { + Template = implementationTemplate; + } + + public Type Template { get; } + } +} diff --git a/src/Pixel.Identity.Core/Conventions/IdentityPageModelConvention.cs b/src/Pixel.Identity.Core/Conventions/IdentityPageModelConvention.cs new file mode 100644 index 0000000..90b4066 --- /dev/null +++ b/src/Pixel.Identity.Core/Conventions/IdentityPageModelConvention.cs @@ -0,0 +1,34 @@ +using Microsoft.AspNetCore.Mvc.ApplicationModels; +using System.Reflection; + +namespace Pixel.Identity.Core.Conventions +{ + public class IdentityPageModelConvention : IPageApplicationModelConvention where TUser : class + { + public void Apply(PageApplicationModel model) + { + var defaultUIAttribute = model.ModelType.GetCustomAttribute(); + if (defaultUIAttribute == null) + { + return; + } + + ValidateTemplate(defaultUIAttribute.Template); + var templateInstance = defaultUIAttribute.Template.MakeGenericType(typeof(TUser)); + model.ModelType = templateInstance.GetTypeInfo(); + } + + private static void ValidateTemplate(Type template) + { + if (template.IsAbstract || !template.IsGenericTypeDefinition) + { + throw new InvalidOperationException("Implementation type can't be abstract or non generic."); + } + var genericArguments = template.GetGenericArguments(); + if (genericArguments.Length != 1) + { + throw new InvalidOperationException("Implementation type contains wrong generic arity."); + } + } + } +} diff --git a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs b/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs deleted file mode 100644 index 814282c..0000000 --- a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Microsoft.AspNetCore.Identity; -using Pixel.Identity.Core.Pages; - -namespace Pixel.Identity.Store.Mongo.Account -{ - public class ConfirmEmailModel : ConfirmEmailModel - { - public ConfirmEmailModel(UserManager userManager) : base(userManager) - { - } - } -} diff --git a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs b/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs deleted file mode 100644 index ccf6c5c..0000000 --- a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Microsoft.AspNetCore.Identity; -using Pixel.Identity.Core; -using Pixel.Identity.Core.Pages; - -namespace Pixel.Identity.Store.Mongo.Account -{ - public class ExternalLoginModel : ExternalLoginModel - { - /// - /// constructor - /// - /// - /// - /// - /// - /// - public ExternalLoginModel(SignInManager signInManager, - UserManager userManager, IUserStore userStore, - ILogger logger, IEmailSender emailSender) - : base(signInManager, userManager, userStore, logger, emailSender) - { - - } - } -} diff --git a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/Login.cshtml.cs b/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/Login.cshtml.cs deleted file mode 100644 index e250b16..0000000 --- a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/Login.cshtml.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Microsoft.AspNetCore.Identity; -using Pixel.Identity.Core.Pages; - -namespace Pixel.Identity.Store.Mongo.Account -{ - public class LoginModel : LoginModel - { - public LoginModel(SignInManager signInManager, ILogger logger) - : base(signInManager, logger) - { - - } - } -} diff --git a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/LoginWith2fa.cshtml.cs b/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/LoginWith2fa.cshtml.cs deleted file mode 100644 index 25f1def..0000000 --- a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/LoginWith2fa.cshtml.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Microsoft.AspNetCore.Identity; -using Pixel.Identity.Core.Pages; - -namespace Pixel.Identity.Store.Mongo.Account -{ - public class LoginWith2faModel : LoginWith2faModel - { - /// - /// constructor - /// - /// - /// - public LoginWith2faModel(SignInManager signInManager, - UserManager userManager) : base(signInManager, userManager) - { - } - } -} diff --git a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml.cs b/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml.cs deleted file mode 100644 index 0fbdb04..0000000 --- a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Microsoft.AspNetCore.Identity; -using Pixel.Identity.Core.Pages; - -namespace Pixel.Identity.Store.Mongo.Account -{ - public class LoginWithRecoveryCodeModel : LoginWithRecoveryCodeModel - { - /// - /// constructor - /// - /// - /// - public LoginWithRecoveryCodeModel(SignInManager signInManager, - UserManager userManager) : base(signInManager, userManager) - { - } - } -} diff --git a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/Register.cshtml.cs b/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/Register.cshtml.cs deleted file mode 100644 index f9d2d25..0000000 --- a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/Register.cshtml.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Identity; -using Pixel.Identity.Core; -using Pixel.Identity.Core.Pages; - -namespace Pixel.Identity.Store.Mongo.Account -{ - [AllowAnonymous] - public class RegisterModel : RegisterModel - { - public RegisterModel(UserManager userManager, IUserStore userStore, - SignInManager signInManager, ILogger logger, - IEmailSender emailSender) : base(userManager, userStore, signInManager, logger, emailSender) - { - } - } -} diff --git a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs b/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs deleted file mode 100644 index 88623dd..0000000 --- a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Microsoft.AspNetCore.Identity; -using Pixel.Identity.Core; -using Pixel.Identity.Core.Pages; - -namespace Pixel.Identity.Store.Mongo.Account -{ - public class RegisterConfirmationModel : RegisterConfirmationModel - { - public RegisterConfirmationModel(UserManager userManager, IEmailSender sender) : base(userManager, sender) - { - } - } -} diff --git a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/ResetPassword.cshtml.cs b/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/ResetPassword.cshtml.cs deleted file mode 100644 index b94bc0e..0000000 --- a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/Account/ResetPassword.cshtml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Microsoft.AspNetCore.Identity; -using Pixel.Identity.Core.Pages; - -namespace Pixel.Identity.Store.Mongo.Account -{ - public class ResetPasswordModel : ResetPasswordModel - { - public ResetPasswordModel(UserManager userManager) : base(userManager) - { - } - } -} diff --git a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/_ViewImports.cshtml b/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/_ViewImports.cshtml index f194864..a75844c 100644 --- a/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/_ViewImports.cshtml +++ b/src/Pixel.Identity.Store.Mongo/Areas/Identity/Pages/_ViewImports.cshtml @@ -7,4 +7,3 @@ @using Microsoft.AspNetCore.Components.Web @using Microsoft.AspNetCore.Components.Web.Virtualization @using Microsoft.JSInterop -@using Pixel.Identity.Store.Mongo.Account diff --git a/src/Pixel.Identity.Store.Mongo/MongoConfigurator.cs b/src/Pixel.Identity.Store.Mongo/MongoConfigurator.cs index 8b187ae..c19afad 100644 --- a/src/Pixel.Identity.Store.Mongo/MongoConfigurator.cs +++ b/src/Pixel.Identity.Store.Mongo/MongoConfigurator.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Identity; using MongoDB.Driver; using Pixel.Identity.Core; +using Pixel.Identity.Core.Conventions; namespace Pixel.Identity.Store.Mongo { @@ -63,7 +64,11 @@ public OpenIddictBuilder ConfigureOpenIdDictStore(IConfiguration configuration, public void AddServices(IServiceCollection services) { services.AddControllersWithViews() - .AddApplicationPart(typeof(ApplicationUser).Assembly); + .AddApplicationPart(typeof(ApplicationUser).Assembly) + .AddRazorPagesOptions(options => + { + options.Conventions.Add(new IdentityPageModelConvention()); + }); services.AddHostedService(); } diff --git a/src/Pixel.Identity.Store.PostgreSQL/SqlConfigurator.cs b/src/Pixel.Identity.Store.PostgreSQL/SqlConfigurator.cs index 569b0e4..e45c146 100644 --- a/src/Pixel.Identity.Store.PostgreSQL/SqlConfigurator.cs +++ b/src/Pixel.Identity.Store.PostgreSQL/SqlConfigurator.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Pixel.Identity.Core; +using Pixel.Identity.Core.Conventions; using Pixel.Identity.Store.PostgreSQL.Data; using Pixel.Identity.Store.Sql.Shared; using static OpenIddict.Abstractions.OpenIddictConstants; @@ -72,7 +73,11 @@ public void AddServices(IServiceCollection services) { services.AddControllersWithViews() .AddApplicationPart(typeof(ApplicationUser).Assembly) - .AddApplicationPart(typeof(SqlConfigurator).Assembly); + .AddApplicationPart(typeof(SqlConfigurator).Assembly) + .AddRazorPagesOptions(options => + { + options.Conventions.Add(new IdentityPageModelConvention()); + }); ; services.AddHostedService(); } } diff --git a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/ConfirmEmail.cshtml b/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/ConfirmEmail.cshtml deleted file mode 100644 index beb1acb..0000000 --- a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/ConfirmEmail.cshtml +++ /dev/null @@ -1,8 +0,0 @@ -@page -@model ConfirmEmailModel -@{ - ViewData["Title"] = "Confirm email"; -} - -

@ViewData["Title"]

- \ No newline at end of file diff --git a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs b/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs deleted file mode 100644 index e612612..0000000 --- a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Microsoft.AspNetCore.Identity; -using Pixel.Identity.Core.Pages; - -namespace Pixel.Identity.Store.Sql.Shared.Account -{ - public class ConfirmEmailModel : ConfirmEmailModel - { - public ConfirmEmailModel(UserManager userManager) : base(userManager) - { - } - } -} diff --git a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/ExternalLogin.cshtml b/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/ExternalLogin.cshtml deleted file mode 100644 index dd26228..0000000 --- a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/ExternalLogin.cshtml +++ /dev/null @@ -1,40 +0,0 @@ -@page -@model ExternalLoginModel - - -
-
- -
-

Associate your @Model.ProviderDisplayName account.

-
- - - -
-
-
- - - -
-
- -
-
-
- -
-
- -@section Scripts { - -} diff --git a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs b/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs deleted file mode 100644 index af26fa3..0000000 --- a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Microsoft.AspNetCore.Identity; -using Pixel.Identity.Core; -using Pixel.Identity.Core.Pages; - -namespace Pixel.Identity.Store.Sql.Shared.Account -{ - public class ExternalLoginModel : ExternalLoginModel - { - /// - /// constructor - /// - /// - /// - /// - /// - /// - public ExternalLoginModel(SignInManager signInManager, - UserManager userManager, IUserStore userStore, - ILogger logger, IEmailSender emailSender) - : base(signInManager, userManager, userStore, logger, emailSender) - { - - } - } -} diff --git a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/Login.cshtml b/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/Login.cshtml deleted file mode 100644 index 5a09cf9..0000000 --- a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/Login.cshtml +++ /dev/null @@ -1,74 +0,0 @@ -@page -@model LoginModel - -
-
- - -
-

Log in with local account

-
-
-
- - - -
-
- - - -
-
-
- -
-
-
- -
- -
-
- -
- @if ((Model.ExternalLogins?.Count ?? 0) > 0) - { - -
-
-

Or Sign in with

-
-
-

- @foreach (var provider in Model.ExternalLogins) - { - - } -

-
-
-
- } -
-
-
- -@section Scripts { - -} diff --git a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/Login.cshtml.cs b/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/Login.cshtml.cs deleted file mode 100644 index f5603b8..0000000 --- a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/Login.cshtml.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Microsoft.AspNetCore.Identity; -using Pixel.Identity.Core.Pages; - -namespace Pixel.Identity.Store.Sql.Shared.Account -{ - public class LoginModel : LoginModel - { - public LoginModel(SignInManager signInManager, ILogger logger) - : base(signInManager, logger) - { - - } - } -} diff --git a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/LoginWith2fa.cshtml b/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/LoginWith2fa.cshtml deleted file mode 100644 index fb09c14..0000000 --- a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/LoginWith2fa.cshtml +++ /dev/null @@ -1,41 +0,0 @@ -@page -@model LoginWith2faModel - -
-
- -
-

Enter authenticator code

-
- -
-
- - - -
-
-
- -
-
-
- -
-
- -

- Don't have access to your authenticator device? You can - log in with a recovery code. -

-
-
-
- -@section Scripts { - -} \ No newline at end of file diff --git a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/LoginWith2fa.cshtml.cs b/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/LoginWith2fa.cshtml.cs deleted file mode 100644 index da9db65..0000000 --- a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/LoginWith2fa.cshtml.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Microsoft.AspNetCore.Identity; -using Pixel.Identity.Core.Pages; - -namespace Pixel.Identity.Store.Sql.Shared.Account -{ - public class LoginWith2faModel : LoginWith2faModel - { - /// - /// constructor - /// - /// - /// - public LoginWith2faModel(SignInManager signInManager, - UserManager userManager) : base(signInManager, userManager) - { - } - } -} diff --git a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml b/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml deleted file mode 100644 index 244ad03..0000000 --- a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml +++ /dev/null @@ -1,27 +0,0 @@ -@page -@model LoginWithRecoveryCodeModel - -
-
- -
-

Log in with a recovery code

-
-
-
- - - -
-
- -
-
-
- -
-
- -@section Scripts { - -} \ No newline at end of file diff --git a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml.cs b/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml.cs deleted file mode 100644 index 65e0b27..0000000 --- a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Microsoft.AspNetCore.Identity; -using Pixel.Identity.Core.Pages; - -namespace Pixel.Identity.Store.Sql.Shared.Account -{ - public class LoginWithRecoveryCodeModel : LoginWithRecoveryCodeModel - { - /// - /// constructor - /// - /// - /// - public LoginWithRecoveryCodeModel(SignInManager signInManager, - UserManager userManager) : base(signInManager, userManager) - { - } - } -} diff --git a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/Register.cshtml b/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/Register.cshtml deleted file mode 100644 index 5ec420b..0000000 --- a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/Register.cshtml +++ /dev/null @@ -1,69 +0,0 @@ -@page -@model RegisterModel - -
-
- -
- -
-

Create a new account.

-
-
-
- - - -
-
- - - -
-
- - - -
-
- -
-
-
- - - -
- @if ((Model.ExternalLogins?.Count ?? 0) > 0) - { - -
-
-

Or Sign in with

-
-
-

- @foreach (var provider in Model.ExternalLogins) - { - - } -

-
-
-
- } -
- -
-
- -@section Scripts { - -} diff --git a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/Register.cshtml.cs b/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/Register.cshtml.cs deleted file mode 100644 index 63268ce..0000000 --- a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/Register.cshtml.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Identity; -using Pixel.Identity.Core; -using Pixel.Identity.Core.Pages; -namespace Pixel.Identity.Store.Sql.Shared.Account -{ - [AllowAnonymous] - public class RegisterModel : RegisterModel - { - public RegisterModel(UserManager userManager, IUserStore userStore, - SignInManager signInManager, ILogger logger, - IEmailSender emailSender) : base(userManager, userStore, signInManager, logger, emailSender) - { - } - } -} diff --git a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml b/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml deleted file mode 100644 index 343a44b..0000000 --- a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml +++ /dev/null @@ -1,23 +0,0 @@ -@page -@model RegisterConfirmationModel -@{ - ViewData["Title"] = "Register confirmation"; -} - -

@ViewData["Title"]

-@{ - if (@Model.DisplayConfirmAccountLink) - { -

- This app does not currently have a real email sender registered, see these docs for how to configure a real email sender. - Normally this would be emailed: Click here to confirm your account -

- } - else - { -

- Please check your email to confirm your account. -

- } -} - diff --git a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs b/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs deleted file mode 100644 index 88e2cc2..0000000 --- a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/RegisterConfirmation.cshtml.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Microsoft.AspNetCore.Identity; -using Pixel.Identity.Core; -using Pixel.Identity.Core.Pages; - -namespace Pixel.Identity.Store.Sql.Shared.Account -{ - public class RegisterConfirmationModel : RegisterConfirmationModel - { - public RegisterConfirmationModel(UserManager userManager, IEmailSender sender) : base(userManager, sender) - { - } - } -} diff --git a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/ResetPassword.cshtml b/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/ResetPassword.cshtml deleted file mode 100644 index ac0a3fc..0000000 --- a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/ResetPassword.cshtml +++ /dev/null @@ -1,42 +0,0 @@ -@page -@model ResetPasswordModel -
-
- -
- - -
-

Reset your password

-
-
- - -
- - - -
-
- - - -
-
- - - -
-
- -
-
-
- -
-
- diff --git a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/ResetPassword.cshtml.cs b/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/ResetPassword.cshtml.cs deleted file mode 100644 index 97ef6c2..0000000 --- a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Account/ResetPassword.cshtml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Microsoft.AspNetCore.Identity; -using Pixel.Identity.Core.Pages; - -namespace Pixel.Identity.Store.Sql.Shared.Account -{ - public class ResetPasswordModel : ResetPasswordModel - { - public ResetPasswordModel(UserManager userManager) : base(userManager) - { - } - } -} diff --git a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Shared/_StatusMessage.cshtml b/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Shared/_StatusMessage.cshtml deleted file mode 100644 index c898543..0000000 --- a/src/Pixel.Identity.Store.Sql.Shared/Areas/Identity/Pages/Shared/_StatusMessage.cshtml +++ /dev/null @@ -1,10 +0,0 @@ -@model string - -@if (!String.IsNullOrEmpty(Model)) -{ - var statusMessageClass = Model.StartsWith("Error") ? "danger" : "success"; - -} diff --git a/src/Pixel.Identity.Store.Sql.Shared/Areas/_ViewImports.cshtml b/src/Pixel.Identity.Store.Sql.Shared/Areas/_ViewImports.cshtml index 9929d8d..a75844c 100644 --- a/src/Pixel.Identity.Store.Sql.Shared/Areas/_ViewImports.cshtml +++ b/src/Pixel.Identity.Store.Sql.Shared/Areas/_ViewImports.cshtml @@ -7,4 +7,3 @@ @using Microsoft.AspNetCore.Components.Web @using Microsoft.AspNetCore.Components.Web.Virtualization @using Microsoft.JSInterop -@using Pixel.Identity.Store.Sql.Shared.Account diff --git a/src/Pixel.Identity.Store.SqlServer/SqlConfigurator.cs b/src/Pixel.Identity.Store.SqlServer/SqlConfigurator.cs index a386b86..70c9bdb 100644 --- a/src/Pixel.Identity.Store.SqlServer/SqlConfigurator.cs +++ b/src/Pixel.Identity.Store.SqlServer/SqlConfigurator.cs @@ -5,6 +5,7 @@ using Pixel.Identity.Store.SqlServer.Data; using Pixel.Identity.Store.Sql.Shared; using static OpenIddict.Abstractions.OpenIddictConstants; +using Pixel.Identity.Core.Conventions; namespace Pixel.Identity.Store.SqlServer { @@ -72,7 +73,11 @@ public void AddServices(IServiceCollection services) { services.AddControllersWithViews() .AddApplicationPart(typeof(ApplicationUser).Assembly) - .AddApplicationPart(typeof(SqlConfigurator).Assembly); + .AddApplicationPart(typeof(SqlConfigurator).Assembly) + .AddRazorPagesOptions(options => + { + options.Conventions.Add(new IdentityPageModelConvention()); + }); ; services.AddHostedService(); } }