예제 #1
0
        public virtual ActionResult Login(string redirectUrl, string code)
        {
            var model = _loginViewModelBuilder.Build(redirectUrl ?? string.Empty);

            if (code != null && int.TryParse(code, out int resultCode) && Enum.IsDefined(typeof(HttpStatusCode), resultCode))
            {
                model.ErrorMessage = $"error.{resultCode}".AsWebSiteString();
                if (User.Identity.IsAuthenticated && resultCode == (int)HttpStatusCode.Unauthorized)
                {
                    model.InsufficientPermissions = true;
                }
            }

            return(View(model));
        }
예제 #2
0
        protected override Task <bool> GetJsonAsync(IOwinEnvironment context, IClient client, CancellationToken cancellationToken)
        {
            var viewModelBuilder = new LoginViewModelBuilder(_configuration.Web.Login, _configuration.Providers);
            var loginViewModel   = viewModelBuilder.Build();

            return(JsonResponse.Ok(context, loginViewModel));
        }