Fixed half of warnings having to do with allowing Null string objects. (#791)

This commit is contained in:
newenay
2022-09-08 16:48:47 -04:00
committed by GitHub
parent 60fe2dae60
commit 36dbc2f256
27 changed files with 65 additions and 65 deletions

View File

@@ -24,24 +24,24 @@ public class LoginModel : PageModel
}
[BindProperty]
public InputModel Input { get; set; }
public InputModel? Input { get; set; }
public IList<AuthenticationScheme> ExternalLogins { get; set; }
public IList<AuthenticationScheme>? ExternalLogins { get; set; }
public string ReturnUrl { get; set; }
public string? ReturnUrl { get; set; }
[TempData]
public string ErrorMessage { get; set; }
public string? ErrorMessage { get; set; }
public class InputModel
{
[Required]
[EmailAddress]
public string Email { get; set; }
public string? Email { get; set; }
[Required]
[DataType(DataType.Password)]
public string Password { get; set; }
public string? Password { get; set; }
[Display(Name = "Remember me?")]
public bool RememberMe { get; set; }
@@ -101,7 +101,7 @@ public class LoginModel : PageModel
return Page();
}
private async Task TransferAnonymousBasketToUserAsync(string userName)
private async Task TransferAnonymousBasketToUserAsync(string? userName)
{
if (Request.Cookies.ContainsKey(Constants.BASKET_COOKIENAME))
{

View File

@@ -32,7 +32,7 @@ public class LogoutModel : PageModel
{
}
public async Task<IActionResult> OnPost(string returnUrl = null)
public async Task<IActionResult> OnPost(string? returnUrl = null)
{
await _signInManager.SignOutAsync();
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);

View File

@@ -34,35 +34,35 @@ public class RegisterModel : PageModel
}
[BindProperty]
public InputModel Input { get; set; }
public InputModel? Input { get; set; }
public string ReturnUrl { get; set; }
public string? ReturnUrl { get; set; }
public class InputModel
{
[Required]
[EmailAddress]
[Display(Name = "Email")]
public string Email { get; set; }
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; }
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 string? ConfirmPassword { get; set; }
}
public void OnGet(string returnUrl = null)
public void OnGet(string? returnUrl = null)
{
ReturnUrl = returnUrl;
}
public async Task<IActionResult> OnPostAsync(string returnUrl = null)
public async Task<IActionResult> OnPostAsync(string? returnUrl = null)
{
returnUrl = returnUrl ?? Url.Content("~/");
if (ModelState.IsValid)