From cb7028660ab29531455a9c2fa80733acb12ed456 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 2 Nov 2024 14:49:25 -0500 Subject: [PATCH] Account/Register - optimize by DI'ing dependencies only on POST --- TASVideos/Pages/Account/Register.cshtml.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/TASVideos/Pages/Account/Register.cshtml.cs b/TASVideos/Pages/Account/Register.cshtml.cs index 978501094..6f0506607 100644 --- a/TASVideos/Pages/Account/Register.cshtml.cs +++ b/TASVideos/Pages/Account/Register.cshtml.cs @@ -6,14 +6,7 @@ namespace TASVideos.Pages.Account; [BindProperties] [AllowAnonymous] [IpBanCheck] -public class RegisterModel( - SignInManager signInManager, - IEmailService emailService, - ExternalMediaPublisher publisher, - IReCaptchaService reCaptchaService, - IHostEnvironment env, - IUserMaintenanceLogger userMaintenanceLogger) - : BasePageModel +public class RegisterModel : BasePageModel { [Required] public string TimeZone { get; set; } = ""; @@ -38,7 +31,13 @@ public class RegisterModel( [MustBeTrue(ErrorMessage = "You must certify that you are 13 years of age or older")] public bool Coppa { get; set; } - public async Task OnPost() + public async Task OnPost( + [FromServices]SignInManager signInManager, + [FromServices]IEmailService emailService, + [FromServices]ExternalMediaPublisher publisher, + [FromServices]IReCaptchaService reCaptchaService, + [FromServices]IHostEnvironment env, + [FromServices]IUserMaintenanceLogger userMaintenanceLogger) { if (Password != ConfirmPassword) {