Beispiel #1
0
        public HttpResponseMessage PostPassword(ChangePasswordRequest changePasswordRequest)
        {
            try
            {
                _userCommandService.ChangeUserPassword(changePasswordRequest.Challenge, changePasswordRequest.NewPassword);

                InformRMSClaimsAuthenticationManager.SetPasswordExpiryClaims(ClaimsPrincipal.Current);
            }
            catch (PasswordPolicyException passwordPolicyException)
            {
                var myError = new
                {
                    violationMessage = passwordPolicyException.ViolationsMessage,
                    violationList    = passwordPolicyException.Violations.ToList()
                };

                return(Request.CreateResponse(HttpStatusCode.InternalServerError, myError));

                //return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, passwordPolicyException.ViolationsMessage, passwordPolicyException);
            }
            catch (Exception innerException)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Service Request Failure", innerException));
            }

            return(Request.CreateResponse("Password was changed successfully."));
        }