Exemple #1
0
        public IActionResult LoginAction(GetTokenRequest requestRequest)
        {
            var result = _connector.EndPoint.Request <GetTokenRequest, ApplicationUserContext>(requestRequest);

            var response = new ResponseModel <int>();

            response.Messages = result.Messages;

            if (result.Messages.Any(a => a.Type == MessageDtoType.Error))
            {
                return(Json(response, Helpers.Json.Serialization.Default()));
            }

            var key = Guid.NewGuid().ToString();

            HttpContext.Response.Cookies.Append("CSRF-TOKEN", key);

            _storage.Set(key, result.Result);

            response.SetRedirect("Redirect", Url.Action("Index", "Portfolios"), "Portfolios");

            return(Json(response, Helpers.Json.Serialization.Default()));
        }