Exemple #1
0
        public ActionResult Login([FromForm] string email, [FromForm] string password, [FromForm] string remember)
        {
            var user = new AccessDto
            {
                Email      = email,
                Password   = password,
                RememberMe = remember == "on" ? true : false,
            };

            if (authService.Login(user))
            {
                return(new RedirectResult("/"));
            }
            else
            {
                throw new NotImplementedException();
                var html = System.IO.File.ReadAllText("Web/chat.html");

                return(new ContentResult
                {
                    StatusCode = 401,
                    ContentType = "text/html",
                    Content = html,
                });
            }
        }
Exemple #2
0
 public ActionResult <string> Login([FromBody] AccessDto user)
 {
     if (authService.Login(user))
     {
         return(new OkResult());
     }
     else
     {
         return(new UnauthorizedResult());
     }
 }