From d15442f4f434a121a2bbec41fbc9115fa343b624 Mon Sep 17 00:00:00 2001 From: Purrrrito <151908737+Purrrrito@users.noreply.github.com> Date: Mon, 9 Dec 2024 14:17:43 -0800 Subject: [PATCH] Fixed all current possible null warnings on the Login page (#349) * Fixed all current possible null warnings on the Login page * Fixed possible nullability issues with Email and Password * Used null forgiving operator for the Required fields Email and Password --------- Co-authored-by: JoeProgrammer88 --- PC2/Areas/Identity/Pages/Account/Login.cshtml.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/PC2/Areas/Identity/Pages/Account/Login.cshtml.cs b/PC2/Areas/Identity/Pages/Account/Login.cshtml.cs index 18b6200..2fdada7 100644 --- a/PC2/Areas/Identity/Pages/Account/Login.cshtml.cs +++ b/PC2/Areas/Identity/Pages/Account/Login.cshtml.cs @@ -31,26 +31,27 @@ public LoginModel(SignInManager signInManager, ILogger /// directly from your code. This API may change or be removed in future releases. /// [BindProperty] - public InputModel Input { get; set; } + [Required] + public InputModel Input { get; set; } = new InputModel(); /// /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// - public IList ExternalLogins { get; set; } + public IList? ExternalLogins { get; set; } /// /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// - public string ReturnUrl { get; set; } + public string? ReturnUrl { get; set; } /// /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// [TempData] - public string ErrorMessage { get; set; } + public string? ErrorMessage { get; set; } /// /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used @@ -64,7 +65,7 @@ public class InputModel /// [Required] [EmailAddress] - public string Email { get; set; } + public string Email { get; set; } = null!; /// /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used @@ -72,7 +73,7 @@ public class InputModel /// [Required] [DataType(DataType.Password)] - public string Password { get; set; } + public string Password { get; set; } = null!; /// /// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used