passwordPolicyService->validate($password, $password2, $required, $email); } public function passwordHints(): array { return $this->passwordPolicyService->hints(); } public function passwordMinLength(): int { return $this->passwordPolicyService->minLength(); } public function resetPassword(int $userId, string $password, string $password2): array { $errors = $this->passwordPolicyService->validate($password, $password2, true, ''); if ($errors) { return ['ok' => false, 'errors' => $errors]; } $updated = $this->userWriteRepository->setPassword($userId, $password); if (!$updated) { return ['ok' => false, 'errors' => [t('Password can not be updated')]]; } return ['ok' => true]; } }