Skip to content

Commit

Permalink
Fixed all current possible null warnings on the Login page (#349)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
Purrrrito and JoeProgrammer88 authored Dec 9, 2024
1 parent caafdda commit d15442f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions PC2/Areas/Identity/Pages/Account/Login.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,27 @@ public LoginModel(SignInManager<IdentityUser> signInManager, ILogger<LoginModel>
/// directly from your code. This API may change or be removed in future releases.
/// </summary>
[BindProperty]
public InputModel Input { get; set; }
[Required]
public InputModel Input { get; set; } = new InputModel();

/// <summary>
/// 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.
/// </summary>
public IList<AuthenticationScheme> ExternalLogins { get; set; }
public IList<AuthenticationScheme>? ExternalLogins { get; set; }

/// <summary>
/// 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.
/// </summary>
public string ReturnUrl { get; set; }
public string? ReturnUrl { get; set; }

/// <summary>
/// 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.
/// </summary>
[TempData]
public string ErrorMessage { get; set; }
public string? ErrorMessage { get; set; }

/// <summary>
/// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
Expand All @@ -64,15 +65,15 @@ public class InputModel
/// </summary>
[Required]
[EmailAddress]
public string Email { get; set; }
public string Email { get; set; } = null!;

/// <summary>
/// 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.
/// </summary>
[Required]
[DataType(DataType.Password)]
public string Password { get; set; }
public string Password { get; set; } = null!;

/// <summary>
/// This API supports the ASP.NET Core Identity default UI infrastructure and is not intended to be used
Expand Down

0 comments on commit d15442f

Please sign in to comment.