PasswordUpdatedEvent.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\User\Events;
  8. use OCP\EventDispatcher\Event;
  9. use OCP\IUser;
  10. /**
  11. * Emitted when the user password has been updated.
  12. *
  13. * @since 18.0.0
  14. */
  15. class PasswordUpdatedEvent extends Event {
  16. /** @var IUser */
  17. private $user;
  18. /** @var string */
  19. private $password;
  20. /** @var string|null */
  21. private $recoveryPassword;
  22. /**
  23. * @param IUser $user
  24. * @param string $password
  25. * @param string|null $recoveryPassword
  26. * @since 18.0.0
  27. */
  28. public function __construct(IUser $user,
  29. string $password,
  30. ?string $recoveryPassword = null) {
  31. parent::__construct();
  32. $this->user = $user;
  33. $this->password = $password;
  34. $this->recoveryPassword = $recoveryPassword;
  35. }
  36. /**
  37. * @return IUser
  38. * @since 18.0.0
  39. */
  40. public function getUser(): IUser {
  41. return $this->user;
  42. }
  43. /**
  44. * @return string
  45. * @since 18.0.0
  46. */
  47. public function getPassword(): string {
  48. return $this->password;
  49. }
  50. /**
  51. * @return string|null
  52. * @since 18.0.0
  53. */
  54. public function getRecoveryPassword(): ?string {
  55. return $this->recoveryPassword;
  56. }
  57. }