ILIAS  release_8 Revision v8.23
class.ilForcedUserPasswordChangeStartUpStep.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
23 
28 {
29  private ilObjUser $user;
30  private ilCtrl $ctrl;
31  private ServerRequestInterface $request;
32 
33  public function __construct(
34  ilObjUser $user,
35  ilCtrl $ctrl,
36  ServerRequestInterface $request
37  ) {
38  $this->user = $user;
39  $this->ctrl = $ctrl;
40  $this->request = $request;
41  }
42 
43  public function shouldStoreRequestTarget(): bool
44  {
45  return true;
46  }
47 
48  public function isInFulfillment(): bool
49  {
50  if (
51  !isset($this->request->getQueryParams()['baseClass']) ||
52  strtolower($this->request->getQueryParams()['baseClass']) !== 'ildashboardgui'
53  ) {
54  return false;
55  }
56 
57  return (
58  strtolower($this->ctrl->getCmdClass()) === 'ilpersonalsettingsgui' &&
59  in_array(strtolower($this->ctrl->getCmd()), ['showpassword', 'savepassword'])
60  );
61  }
62 
63  public function shouldInterceptRequest(): bool
64  {
65  if (ilSession::get('used_external_auth')) {
66  return false;
67  }
68 
69  if (!$this->isInFulfillment() && ($this->user->isPasswordChangeDemanded() || $this->user->isPasswordExpired())) {
70  return true;
71  }
72 
73  return false;
74  }
75 
76  public function execute(): void
77  {
78  $this->ctrl->redirectByClass(
79  ['ildashboardgui', 'ilpersonalsettingsgui'],
80  'showPassword'
81  );
82  }
83 }
static get(string $a_var)
__construct(ilObjUser $user, ilCtrl $ctrl, ServerRequestInterface $request)