1
0

PasswordUpdatedEvent.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. * @since 31.0.0
  45. */
  46. public function getUid(): string {
  47. return $this->user->getUID();
  48. }
  49. /**
  50. * @return string
  51. * @since 18.0.0
  52. */
  53. public function getPassword(): string {
  54. return $this->password;
  55. }
  56. /**
  57. * @return string|null
  58. * @since 18.0.0
  59. */
  60. public function getRecoveryPassword(): ?string {
  61. return $this->recoveryPassword;
  62. }
  63. }