Fixed crash on login
Fixed crash where if the user tries to login with a wrong or non-existent username it crashes the app
This commit is contained in:
@@ -86,7 +86,7 @@ namespace WebApp.Areas.Identity.Pages.Account
|
|||||||
{
|
{
|
||||||
// This doesn't count login failures towards account lockout
|
// This doesn't count login failures towards account lockout
|
||||||
// To enable password failures to trigger account lockout, set lockoutOnFailure: true
|
// To enable password failures to trigger account lockout, set lockoutOnFailure: true
|
||||||
var result = await _signInManager.PasswordSignInAsync(rentACarDbContext.Users.FirstOrDefault(user => user.UserName == Input.Username), Input.Password, Input.RememberMe, lockoutOnFailure: false);
|
var result = await _signInManager.PasswordSignInAsync(rentACarDbContext.Users.FirstOrDefault(user => user.UserName == Input.Username) ?? new User(), Input.Password, Input.RememberMe, lockoutOnFailure: false);
|
||||||
if (result.Succeeded)
|
if (result.Succeeded)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("User logged in.");
|
_logger.LogInformation("User logged in.");
|
||||||
|
|||||||
Reference in New Issue
Block a user