title: After invalid login, showing null reference exception
body: <p>This is my Controller code:</p>
  
  <pre><code>  public async Task&lt;ActionResult&gt; Login(LoginViewModel model, string returnUrl)
      {
          if (!ModelState.IsValid)
          {
              return View(model);
          }
          var user = await UserManager.FindByEmailAsync(model.Email);
          if (user != null)
          {
              if (!await UserManager.IsEmailConfirmedAsync(user.Id))
              {
                  ViewBag.Email = user.Email;
                  return View("UnconfirmedAccount");
              }
          }
   // Error is showing at this line System.nullReferenceException
          var result = await SignInManager.PasswordSignInAsync(user.UserName, model.Password, model.RememberMe, shouldLockout: false);
          switch (result)
          {
              case SignInStatus.Success:
                  return RedirectToLocal(returnUrl);
              case SignInStatus.LockedOut:
                  return View("Lockout");
              case SignInStatus.RequiresVerification:
                  return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe });
              case SignInStatus.Failure:
              default:
                  ModelState.AddModelError("", "Invalid login attempt.");
                  return View(model);
          }
      }
  </code></pre>
  
  <p>I am login the user with email and password.If login id and password are correct then SignInStatus.Success case calls succesfully.
  But,if login fails then its showing system.NullRefernceException.</p>
  
  <p><strong>Now, most important thing, i have seperated username and email successfully at register times.Now, at registration i am saving email and username in their respective column.Before email also got saved in username column.
  But after seperating username and email, i was unable to login so i have to change this line in login action method fro this:</strong></p>
  
  <pre><code>var result = await SignInManager.PasswordSignInAsync(user.Email, model.Password, model.RememberMe, shouldLockout: false);
  </code></pre>
  
  <p>to this:</p>
  
  <pre><code>var result = await SignInManager.PasswordSignInAsync(user.UserName, model.Password, model.RememberMe, shouldLockout: false);
  </code></pre>
  
  <p>I just want to show invalid login attempt message as it was showing before not this yellow screen. how to do it. </p>