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.

LoginData.php 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. /**
  3. * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
  4. *
  5. * @author 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. */
  23. declare(strict_types=1);
  24. namespace OC\Authentication\Login;
  25. use OCP\IRequest;
  26. use OCP\IUser;
  27. class LoginData {
  28. /** @var IRequest */
  29. private $request;
  30. /** @var string */
  31. private $username;
  32. /** @var string */
  33. private $password;
  34. /** @var string */
  35. private $redirectUrl;
  36. /** @var string */
  37. private $timeZone;
  38. /** @var string */
  39. private $timeZoneOffset;
  40. /** @var IUser|false|null */
  41. private $user = null;
  42. /** @var bool */
  43. private $rememberLogin = true;
  44. public function __construct(IRequest $request,
  45. string $username,
  46. ?string $password,
  47. string $redirectUrl = null,
  48. string $timeZone = '',
  49. string $timeZoneOffset = '') {
  50. $this->request = $request;
  51. $this->username = $username;
  52. $this->password = $password;
  53. $this->redirectUrl = $redirectUrl;
  54. $this->timeZone = $timeZone;
  55. $this->timeZoneOffset = $timeZoneOffset;
  56. }
  57. public function getRequest(): IRequest {
  58. return $this->request;
  59. }
  60. public function setUsername(string $username): void {
  61. $this->username = $username;
  62. }
  63. public function getUsername(): string {
  64. return $this->username;
  65. }
  66. public function getPassword(): ?string {
  67. return $this->password;
  68. }
  69. public function getRedirectUrl(): ?string {
  70. return $this->redirectUrl;
  71. }
  72. public function getTimeZone(): string {
  73. return $this->timeZone;
  74. }
  75. public function getTimeZoneOffset(): string {
  76. return $this->timeZoneOffset;
  77. }
  78. /**
  79. * @param IUser|false|null $user
  80. */
  81. public function setUser($user) {
  82. $this->user = $user;
  83. }
  84. /**
  85. * @return false|IUser|null
  86. */
  87. public function getUser() {
  88. return $this->user;
  89. }
  90. public function setRememberLogin(bool $rememberLogin): void {
  91. $this->rememberLogin = $rememberLogin;
  92. }
  93. public function isRememberLogin(): bool {
  94. return $this->rememberLogin;
  95. }
  96. }