Ejemplo n.º 1
0
 public IActionResult Login([FromForm] LoginModel login)
 {
     try
     {
         if (common.CreateHashPassword(login.password).Equals(dbAccessor.GetUserPassword(login.username), StringComparison.InvariantCultureIgnoreCase))
         {
             UserModel user = dbAccessor.GetUserByUsername(login.username);
             Session.userId   = user.userId;
             Session.username = login.username;
             return(Redirect("https://localhost:5001/"));
         }
         else
         {
             return(Redirect("https://localhost:5001/Home/Login"));
         }
     }
     catch (Exception ex)
     {
         return(Redirect("https://localhost:5001/Home/Login"));
     }
 }