checkCustomerAccount = $checkCustomerAccount; $this->checkCustomerPassword = $checkCustomerPassword; $this->accountManagement = $accountManagement; $this->customerDataProvider = $customerDataProvider; } /** * @inheritdoc */ public function resolve( Field $field, $context, ResolveInfo $info, array $value = null, array $args = null ) { if (!isset($args['currentPassword'])) { throw new GraphQlInputException(__('Specify the "currentPassword" value.')); } if (!isset($args['newPassword'])) { throw new GraphQlInputException(__('Specify the "newPassword" value.')); } $currentUserId = $context->getUserId(); $currentUserType = $context->getUserType(); $this->checkCustomerAccount->execute($currentUserId, $currentUserType); $currentUserId = (int)$currentUserId; $this->checkCustomerPassword->execute($args['currentPassword'], $currentUserId); $this->accountManagement->changePasswordById($currentUserId, $args['currentPassword'], $args['newPassword']); $data = $this->customerDataProvider->getCustomerById($currentUserId); return $data; } }