Пример #1
0
        public async Task <JsonResult> TrySignIn(LoginInput input)
        {
            var response = _service.TryAuthenticate(input);

            if (response.Success)
            {
                var redirectUrl = input.ReturnUrl.IsNullOrWhitespace() ? "/" : input.ReturnUrl;
                await HttpContext.AuthenticateUser(input.UserName, "guest", input.RememberMe);

                return(Json(CommandResponse.Ok().AddRedirectUrl(redirectUrl)));
            }

            return(Json(CommandResponse.Fail().AddMessage(response.Message)));
        }