LoginData.php 2.6 KB

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