ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilForcedUserPasswordChangeStartUpStep.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
5use Psr\Http\Message\ServerRequestInterface;
6
11{
13 private $user;
15 private $ctrl;
17 private $request;
18
25 public function __construct(ilObjUser $user, ilCtrl $ctrl, ServerRequestInterface $request)
26 {
27 $this->user = $user;
28 $this->ctrl = $ctrl;
29 $this->request = $request;
30 }
31
35 public function shouldStoreRequestTarget() : bool
36 {
37 return true;
38 }
39
43 public function isInFulfillment() : bool
44 {
45 if (
46 !isset($this->request->getQueryParams()['baseClass']) ||
47 strtolower($this->request->getQueryParams()['baseClass']) !== 'ildashboardgui'
48 ) {
49 return false;
50 }
51
52 return (
53 strtolower($this->ctrl->getCmdClass()) === 'ilpersonalsettingsgui' &&
54 in_array(strtolower($this->ctrl->getCmd()), ['showpassword', 'savepassword'])
55 );
56 }
57
61 public function shouldInterceptRequest() : bool
62 {
63 if (ilSession::get('used_external_auth')) {
64 return false;
65 }
66
67 if (!$this->isInFulfillment() && ($this->user->isPasswordChangeDemanded() || $this->user->isPasswordExpired())) {
68 return true;
69 }
70
71 return false;
72 }
73
77 public function execute() : void
78 {
79 $this->ctrl->initBaseClass('ildashboardgui');
80 $this->ctrl->redirectByClass(
81 ['ildashboardgui', 'ilpersonalsettingsgui'],
82 'showPassword'
83 );
84 }
85}
user()
Definition: user.php:4
An exception for terminatinating execution or to throw for unit testing.
This class provides processing control methods.
__construct(ilObjUser $user, ilCtrl $ctrl, ServerRequestInterface $request)
ilForcedUserPasswordChangeStartUpStep constructor.
static get($a_var)
Get a value.