Skip to content

Commit

Permalink
Account/Register - optimize by DI'ing dependencies only on POST
Browse files Browse the repository at this point in the history
  • Loading branch information
adelikat committed Nov 2, 2024
1 parent 7dcebd3 commit cb70286
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions TASVideos/Pages/Account/Register.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; } = "";
Expand All @@ -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<IActionResult> OnPost()
public async Task<IActionResult> OnPost(
[FromServices]SignInManager signInManager,
[FromServices]IEmailService emailService,
[FromServices]ExternalMediaPublisher publisher,
[FromServices]IReCaptchaService reCaptchaService,
[FromServices]IHostEnvironment env,
[FromServices]IUserMaintenanceLogger userMaintenanceLogger)
{
if (Password != ConfirmPassword)
{
Expand Down

0 comments on commit cb70286

Please sign in to comment.