Exemplo n.º 1
0
        public async Task <IActionResult> Login(string userName, string password, [FromServices] DBTester tester)
        {
            Customer cu = tester.ValidCustomer(userName);

            password = AuthHash.GetSimpleHash(password);


            if (cu == null)
            {
                TempData["ErrorMessage"] = "true";
                return(View());
            }

            if (cu.Password == password)
            {
                HttpContext.Session.SetString("username", userName);
                return(RedirectToAction("Index"));
            }

            else
            {
                TempData["ErrorMessage"] = "true";
                return(View());
            }
        }
Exemplo n.º 2
0
 public Customer(String username, String password)
 {
     this.Id       = Guid.NewGuid().ToString();
     this.Name     = username;
     this.Password = AuthHash.GetSimpleHash(password);
 }