Пример #1
0
        public async Task <ActionResult> ResetPassword(string staffId)
        {
            var response = await _httpClientService.GetJsonContent("api/maintenance/adminsettings");

            if (response.IsSuccessStatusCode)
            {
                var content = await response.Content.ReadAsAsync <MaintenanceEditModel>();

                var passwordLength    = content != null ? content.PasswordLength : 0;
                var specialCharacters = content != null ? content.PasswordSpecialCharacters : 0;

                var model = new StaffResetPasswordModel
                {
                    Id                        = staffId,
                    PasswordLength            = passwordLength,
                    PasswordSpecialCharacters = specialCharacters,
                    Length                    = passwordLength,
                    SpecialCharacters         = specialCharacters
                };

                return(PartialView("_ResetPassword", model: model));
            }

            return(HttpNotFound());
        }
Пример #2
0
        public async Task <ActionResult> ResetPassword(StaffResetPasswordModel model)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView("_ResetPassword", model: model));
            }

            var result = await _httpClientService.SendRequest("api/admin/password/reset", HttpMethod.Put, model);

            if (result.IsSuccessStatusCode)
            {
                return(NotificationSuccessResult(Resource.UserPasswordResetSuccess));
            }

            var errorMessage = await _commonService.CheckForValidationErrors(result, Resource.ApplicationErrorText);

            return(NotificationErrorResult(errorMessage));
        }