コード例 #1
0
        public IActionResult UpdatePassword([FromBody] PasswordUpdateInput passwordUpdateInput)
        {
            if (ModelState.IsValid)
            {
                if (userCommandService.UpdatePassword(CustomAuthorizationHelper.GetCurrentUserId(User), passwordUpdateInput.NewPassword, passwordUpdateInput.OldPassword))
                {
                    return(Ok("Password has been changed."));
                }
                else
                {
                    return(BadRequest("Old password not correct!"));
                }
            }

            else
            {
                return(BadRequest("Not all fields were filled in correctly"));
            }
        }