public function changePassword(Account $account, string $oldPassword, string $newPassword) : string { if (!$this->passwordVerifyService->verifyPassword($account, $oldPassword)) { throw new InvalidOldPasswordException('Invalid old password'); } $account->setPassword($this->passwordVerifyService->generatePassword($newPassword)); $this->accountRepository->saveAccount($account); return $account->getAPIKey(); }
public function verifyPassword(Account $account, string $password) : bool { return $this->passwordVerifyService->verifyPassword($account, $password); }