You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
2.7 KiB

3 years ago
  1. <?php
  2. /**
  3. * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  6. * @author Roeland Jago Douma <roeland@famdouma.nl>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. declare(strict_types=1);
  25. namespace OC\Authentication\Login;
  26. use OCP\IRequest;
  27. use OCP\IUser;
  28. class LoginData {
  29. /** @var IRequest */
  30. private $request;
  31. /** @var string */
  32. private $username;
  33. /** @var string */
  34. private $password;
  35. /** @var string */
  36. private $redirectUrl;
  37. /** @var string */
  38. private $timeZone;
  39. /** @var string */
  40. private $timeZoneOffset;
  41. /** @var IUser|false|null */
  42. private $user = null;
  43. /** @var bool */
  44. private $rememberLogin = true;
  45. public function __construct(IRequest $request,
  46. string $username,
  47. ?string $password,
  48. string $redirectUrl = null,
  49. string $timeZone = '',
  50. string $timeZoneOffset = '') {
  51. $this->request = $request;
  52. $this->username = $username;
  53. $this->password = $password;
  54. $this->redirectUrl = $redirectUrl;
  55. $this->timeZone = $timeZone;
  56. $this->timeZoneOffset = $timeZoneOffset;
  57. }
  58. public function getRequest(): IRequest {
  59. return $this->request;
  60. }
  61. public function setUsername(string $username): void {
  62. $this->username = $username;
  63. }
  64. public function getUsername(): string {
  65. return $this->username;
  66. }
  67. public function getPassword(): ?string {
  68. return $this->password;
  69. }
  70. public function getRedirectUrl(): ?string {
  71. return $this->redirectUrl;
  72. }
  73. public function getTimeZone(): string {
  74. return $this->timeZone;
  75. }
  76. public function getTimeZoneOffset(): string {
  77. return $this->timeZoneOffset;
  78. }
  79. /**
  80. * @param IUser|false|null $user
  81. */
  82. public function setUser($user) {
  83. $this->user = $user;
  84. }
  85. /**
  86. * @return false|IUser|null
  87. */
  88. public function getUser() {
  89. return $this->user;
  90. }
  91. public function setRememberLogin(bool $rememberLogin): void {
  92. $this->rememberLogin = $rememberLogin;
  93. }
  94. public function isRememberLogin(): bool {
  95. return $this->rememberLogin;
  96. }
  97. }