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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
  5. *
  6. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  7. * @author Roeland Jago Douma <roeland@famdouma.nl>
  8. *
  9. * @license GNU AGPL version 3 or any later version
  10. *
  11. * This program is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License as
  13. * published by the Free Software Foundation, either version 3 of the
  14. * License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. *
  24. */
  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. }