public IActionResult ChangeSecret([FromBody] ChangeSecret secret)
        {
            var result = secretManager.Validate(secret.Secret);

            if (result.IsFailure)
            {
                return(HttpErrorResult(StatusCodes.Status406NotAcceptable, result.Error));
            }

            secretManager.Change(secret.Secret);

            return(Ok());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Index(SetupModel model)
        {
            var validationFailures = await licenseManager.SaveAsync(model.LicenseKey);

            if (validationFailures.Any())
            {
                TempData["ValidationFailures"] = JsonConvert.SerializeObject(validationFailures);

                return(RedirectToAction("Index"));
            }

            var result = secretManager.Validate(model.Secret);

            if (result.IsSuccess && !secretManager.IsSet())
            {
                secretManager.Change(model.Secret);
            }

            return(RedirectToAction("Index"));
        }