150 : Form
151 {
152 $entered_current_passwd = null;
153
154 $items = [];
155 if ($this->password_manager->allowPasswordChange($this->user)) {
156 $pw_info_set = false;
158 $current_passwd = $this->ui_factory
159 ->input()
160 ->field()
161 ->password(
162 $this->
lng->txt(self::CURRENT_PASSWORD),
164 )
165 ->withRevelation(true)
166 ->withAdditionalTransformation(
167 $this->
refinery->custom()->constraint(
168 function (
Password $value) use (&$entered_current_passwd):
bool {
169 $entered_current_passwd = $value;
170
171 return
173 LocalUserPasswordManager::getInstance()->verifyPassword(
174 $this->user,
176 );
177 },
178 $this->
lng->txt(
'passwd_wrong')
179 )
180 )
182
183 $pw_info_set = true;
184 if ($this->
user->getPasswd()) {
185 $current_passwd = $current_passwd->withRequired(true);
186 }
187
189 }
190
191 $new_passwd = $this->ui_factory
192 ->input()
193 ->field()
194 ->password(
195 $this->
lng->txt(
'desired_password'),
196 )
197 ->withRevelation(true)
198 ->withRequired(true)
201 ->withAdditionalTransformation(
202 $this->
refinery->custom()->constraint(
203 function (
Password $value) use (&$entered_current_passwd):
bool {
204 if ($entered_current_passwd === null) {
205 return true;
206 }
207
208 $passwords_equal = $entered_current_passwd->toString() === $value->
toString();
209 $is_forced_change = $this->user->isPasswordChangeDemanded()
210 || $this->user->isPasswordExpired();
211
212 return !($passwords_equal && $is_forced_change);
213 },
214 $this->
lng->txt(
'new_pass_equals_old_pass')
215 )
216 )
218
219 if ($pw_info_set === false) {
221 }
222
224
225 switch ($this->
user->getAuthMode(
true)) {
227 $title = $this->
lng->txt(
'chg_password');
228
229 break;
231 default:
232 $title = $this->
lng->txt(
'chg_ilias_password');
233
234 break;
235 }
236
237 $items = [
238 $this->ui_factory->input()->field()->section($items, $title)
239 ];
240 }
241
242 $form = $this->ui_factory
243 ->input()
244 ->container()
245 ->form()
246 ->standard(
247 $this->
ctrl->getLinkTarget($this,
'savePassword'),
248 $items
249 )
250 ->withSubmitLabel($this->
lng->txt(
'save'))
251 ->withAdditionalTransformation(
252 $this->
refinery->custom()->transformation(
static function (array $values): array {
253 return array_merge(...$values);
254 })
255 );
256
257 return $form;
258 }
A password is used as part of credentials for authentication.
const int AUTH_SHIBBOLETH
securePasswordConstraint()
validInUserContextConstraint()
const string CURRENT_PASSWORD
const string NEW_PASSWORD
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()