Exemplo n.º 1
0
        public ActionResult LoginForm(IFormCollection collection)
        {
            bool loginOk = false;

            var name     = collection["AccountName"];
            var password = collection["AccountPassword"];

            loginOk = userService.LoginUser(name, password);
            if (loginOk != true)
            {
                return(RedirectToAction(nameof(Login)));
            }
            var token = userService.CreateToken(name); // Variables to create token with?

            HttpContext.Session.SetString("JWToken", token);
            var sessionString = HttpContext.Session.GetString("JWToken");

            return(RedirectToAction(nameof(UserView)));
        }