19 declare(strict_types=1);
67 $this->tpl = $DIC[
'tpl'];
68 $this->ui_factory = $DIC[
'ui.factory'];
69 $this->ui_renderer = $DIC[
'ui.renderer'];
70 $this->
lng = $DIC[
'lng'];
71 $this->
ctrl = $DIC[
'ilCtrl'];
72 $this->log = $DIC->logger();
73 $this->mail_sender_factory = $DIC->mail()->mime()->senderFactory();
74 $this->
help = $DIC[
'ilHelp'];
75 $this->
tabs = $DIC[
'ilTabs'];
76 $this->
toolbar = $DIC[
'ilToolbar'];
77 $this->
user = $DIC[
'ilUser'];
79 $this->auth_session = $DIC[
'ilAuthSession'];
80 $this->rbac_system = $DIC[
'rbacsystem'];
81 $this->style_definition = $DIC[
'styleDefinition'];
82 $this->navigation_history = $DIC[
'ilNavigationHistory'];
83 $this->upload_error =
'';
84 $this->password_error =
'';
85 $this->
lng->loadLanguageModule(
'user');
86 $this->
ctrl->saveParameter($this,
'user_page');
103 $this->entered_new_password = $this->request->getNewPassword();
104 $this->entered_current_password = $this->request->getCurrentPassword();
112 $next_class = $this->
ctrl->getNextClass();
114 switch ($next_class) {
115 case 'ilmailoptionsgui':
121 $this->
tabs->activateTab(
'mail_settings');
127 $cmd = $this->
ctrl->getCmd(
'showGeneralSettings');
135 $this->
help->setScreenIdComponent(
'user');
137 $showPassword = $a_cmd ==
'showPassword';
138 $showGeneralSettings = $a_cmd ==
'showGeneralSettings';
140 $this->
tabs->addTarget(
142 $this->
ctrl->getLinkTarget($this,
'showGeneralSettings'),
150 $this->
tabs->addTarget(
152 $this->
ctrl->getLinkTarget($this,
'showPassword'),
161 && $this->
settings->get(
'show_mail_settings')) {
162 $this->
ctrl->setParameter($this,
'referrer',
'ilPersonalSettingsGUI');
164 $this->
tabs->addTarget(
166 $this->
ctrl->getLinkTargetByClass(
'ilMailOptionsGUI'),
172 if ($this->
settings->get(
'user_delete_own_account') &&
176 $this->
lng->txt(
'user_delete_own_account'),
177 $this->
ctrl->getLinkTarget($this,
'deleteOwnAccountStep1')
184 $this->tpl->setTitle($this->
lng->txt(
'personal_settings'));
188 bool $a_no_init =
false,
189 bool $hide_form =
false 192 $this->
tabs->activateTab(
'password');
197 if ($this->
user->isPasswordChangeDemanded()) {
198 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'password_change_on_first_login_demand'));
199 } elseif ($this->
user->isPasswordExpired()) {
200 $msg = $this->
lng->txt(
'password_expired');
201 $password_age = $this->
user->getPasswordAge();
202 $this->tpl->setOnScreenMessage(
'info', sprintf($msg, $password_age));
205 if (!$a_no_init && !$hide_form) {
208 $this->tpl->setContent(!$hide_form ? $this->
form->getHTML() :
'');
209 $this->tpl->printToStdout();
217 $pw_info_set =
false;
222 $cpass->setRetype(
false);
223 $cpass->setSkipSyntaxCheck(
true);
226 if ($this->
user->getPasswd()) {
227 $cpass->setRequired(
true);
229 $this->
form->addItem($cpass);
234 if ($pw_info_set ===
false) {
237 $ipass->setRequired(
true);
238 $ipass->setUseStripSlashes(
false);
240 $this->
form->addItem($ipass);
241 $this->
form->addCommandButton(
'savePassword', $this->
lng->txt(
'save'));
243 switch ($this->
user->getAuthMode(
true)) {
245 $this->
form->setTitle($this->
lng->txt(
'chg_password'));
251 $this->
form->setTitle($this->
lng->txt(
'chg_ilias_and_webfolder_password'));
253 $this->
form->setTitle($this->
lng->txt(
'chg_ilias_password'));
257 $this->
form->setTitle($this->
lng->txt(
'chg_ilias_password'));
260 $this->
form->setFormAction($this->
ctrl->getFormAction($this));
278 return \ilAuthUtils::isPasswordModificationHidden()
279 && ($this->
user->isPasswordChangeDemanded() || $this->
user->isPasswordExpired());
285 $this->
ctrl->redirect($this,
'showPersonalData');
290 if ($this->
form->checkInput()) {
291 $cp = $this->
form->getItemByPostVar(
'current_password');
292 $np = $this->
form->getItemByPostVar(
'new_password');
298 $cp->setAlert($this->
lng->txt(
'passwd_wrong'));
304 if ($custom_error !=
'') {
305 $np->setAlert($custom_error);
307 $np->setAlert($this->
lng->txt(
'passwd_invalid'));
312 $this->entered_new_password,
316 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'form_input_not_valid'));
317 $np->setAlert($this->
lng->txt($error_lng_var));
320 if (($this->
user->isPasswordExpired() || $this->
user->isPasswordChangeDemanded())
321 && $this->entered_current_password == $this->entered_new_password) {
323 $np->setAlert($this->
lng->txt(
'new_pass_equals_old_pass'));
327 $this->
user->resetPassword($this->entered_new_password, $this->entered_new_password);
328 if ($this->entered_current_password != $this->entered_new_password) {
329 $this->
user->setLastPasswordChangeToNow();
330 $this->
user->setPasswordPolicyResetStatus(
false);
331 $this->
user->update();
335 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'),
true);
340 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'saved_successfully'));
346 $this->
form->setValuesByPost();
352 return $this->user_settings_config->isVisibleAndChangeable($setting);
357 return $this->user_settings_config->isVisible($setting);
362 return $this->user_settings_config->isChangeable($setting);
368 $this->
tabs->activateTab(
'general_settings');
375 $this->tpl->setContent($this->
form->getHTML());
376 $this->tpl->printToStdout();
385 $languages = $this->
lng->getInstalledLanguages();
387 foreach ($languages as $lang_key) {
393 $lang->setOptions($options);
394 $lang->setValue($this->
user->getLanguage());
395 if (count($options) <= 1 || $this->
settings->get(
'usr_settings_disable_language') ===
'1') {
396 $lang->setDisabled(
true);
403 $skins = $this->style_definition->getAllSkins();
404 if (is_array($skins)) {
408 foreach ($skins as $skin) {
409 foreach ($skin->getStyles() as $style) {
414 $options[$skin->getId() .
':' . $style->getId()] = $skin->getName() .
' / ' . $style->getName();
418 $si->setValue($this->
user->skin .
':' . $this->user->prefs[
'style']);
419 $si->setDisabled((
bool) $this->
settings->get(
'usr_settings_disable_skin_style'));
420 $this->
form->addItem($si);
425 $this->
help->addPersonalSettingToLegacyForm($this->
form);
431 $hits_options = [10,15,20,30,40,50,100,9999];
434 foreach ($hits_options as $hits_option) {
435 $hstr = ($hits_option == 9999)
436 ? $this->
lng->txt(
'no_limit')
438 $options[$hits_option] = $hstr;
440 $si->setOptions($options);
441 $si->setValue($this->
user->prefs[
'hits_per_page']);
442 $si->setDisabled((
bool) $this->
settings->get(
'usr_settings_disable_hits_per_page'));
443 $this->
form->addItem($si);
446 $lv =
new ilSelectInputGUI($this->
lng->txt(
'user_store_last_visited'),
'store_last_visited');
448 0 => $this->
lng->txt(
'user_lv_keep_entries'),
449 1 => $this->
lng->txt(
'user_lv_keep_only_for_session'),
450 2 => $this->
lng->txt(
'user_lv_do_not_store')
453 $last_visited = (
int) ($this->
user->prefs[
'store_last_visited'] ?? 0);
454 $lv->setValue($last_visited);
455 $this->
form->addItem($lv);
458 if (ilSessionReminder::isGloballyActivated()) {
460 $cb->setInfo($this->
lng->txt(
'session_reminder_info'));
462 $cb->setChecked((
bool) $this->
user->getPref(
'session_reminder_enabled'));
465 $lead_time_gui =
new ilNumberInputGUI($this->
lng->txt(
'session_reminder_lead_time'),
'session_reminder_lead_time');
469 $max_value = max($min_value, ($expires / 60) - 1);
471 $current_user_value = $this->
user->getPref(
'session_reminder_lead_time');
472 if ($current_user_value < $min_value ||
473 $current_user_value > $max_value) {
484 $lead_time_gui->setValue((
string) $value);
485 $lead_time_gui->setSize(3);
486 $lead_time_gui->setMinValue($min_value);
487 $lead_time_gui->setMaxValue($max_value);
488 $cb->addSubItem($lead_time_gui);
490 $this->
form->addItem($cb);
496 $this->
lng->loadLanguageModule(
'dateplaner');
501 $select->setInfo($this->
lng->txt(
'cal_timezone_info'));
502 $select->setValue($user_settings->getTimeZone());
503 $this->
form->addItem($select);
512 $select->setInfo($this->
lng->txt(
'cal_date_format_info'));
513 $select->setValue($user_settings->getDateFormat());
514 $this->
form->addItem($select);
521 $select->setInfo($this->
lng->txt(
'cal_time_format_info'));
522 $select->setValue($user_settings->getTimeFormat());
523 $this->
form->addItem($select);
525 if ($this->starting_point_repository->isPersonalStartingPointEnabled()) {
526 $this->
lng->loadLanguageModule(
'administration');
529 $si->setInfo($this->
lng->txt(
'adm_user_starting_point_info'));
530 $def_opt =
new ilRadioOption($this->
lng->txt(
'adm_user_starting_point_inherit'),
'0');
531 $def_opt->
setInfo($this->
lng->txt(
'adm_user_starting_point_inherit_info'));
532 $si->addOption($def_opt);
533 foreach ($this->starting_point_repository->getPossibleStartingPoints() as $value => $caption) {
537 $si->addOption(
new ilRadioOption($this->
lng->txt($caption), (string) $value));
539 $si->setValue((
string) $this->starting_point_repository->getCurrentUserPersonalStartingPoint());
540 $this->
form->addItem($si);
544 $this->
lng->txt(
'adm_user_starting_point_object'),
547 $repobj_id =
new ilTextInputGUI($this->
lng->txt(
'adm_user_starting_point_ref_id'),
'usr_start_ref_id');
548 $repobj_id->setInfo($this->
lng->txt(
'adm_user_starting_point_ref_id_info'));
549 $repobj_id->setRequired(
true);
550 $repobj_id->setSize(5);
552 $start_ref_id = $this->starting_point_repository->getCurrentUserPersonalStartingObject();
553 $repobj_id->setValue($start_ref_id);
562 $repobj->addSubItem($repobj_id);
563 $si->addOption($repobj);
566 $this->
form->addCommandButton(
'saveGeneralSettings', $this->
lng->txt(
'save'));
567 $this->
form->setTitle($this->
lng->txt(
'general_settings'));
568 $this->
form->setFormAction($this->
ctrl->getFormAction($this));
574 if ($this->
form->checkInput()
578 if ($this->
form->getInput(
'skin_style') !=
'') {
579 $sknst = explode(
':', $this->
form->getInput(
'skin_style'));
581 if ($this->
user->getPref(
'style') != $sknst[1] ||
582 $this->
user->getPref(
'skin') != $sknst[0]) {
583 $this->
user->setPref(
'skin', $sknst[0]);
584 $this->
user->setPref(
'style', $sknst[1]);
591 $this->
user->setLanguage($this->
form->getInput(
'language'));
596 if ($this->
form->getInput(
'hits_per_page') !=
'') {
597 $this->
user->setPref(
'hits_per_page', $this->
form->getInput(
'hits_per_page'));
602 $this->
help->savePersonalSettingFromLegacyForm($this->
form);
604 $this->
user->setPref(
'store_last_visited', $this->
form->getInput(
'store_last_visited'));
605 if ((
int) $this->
form->getInput(
'store_last_visited') > 0) {
606 $this->navigation_history->deleteDBEntries();
607 if ((
int) $this->
form->getInput(
'store_last_visited') == 2) {
608 $this->navigation_history->deleteSessionEntries();
612 if (ilSessionReminder::isGloballyActivated()) {
613 $this->
user->setPref(
'session_reminder_enabled', $this->
form->getInput(
'session_reminder_enabled'));
614 $this->
user->setPref(
'session_reminder_lead_time', (
string) $this->
form->getInput(
'session_reminder_lead_time'));
617 if ($this->starting_point_repository->isPersonalStartingPointEnabled()) {
618 $s_ref_id = $this->
form->getInput(
'usr_start_ref_id');
619 $s_ref_id = ($s_ref_id ===
'')
622 $this->starting_point_repository->setCurrentUserPersonalStartingPoint(
623 (
int) $this->
form->getInput(
'usr_start'),
628 $this->
user->update();
632 $user_settings->setTimeZone($this->
form->getInput(
'timezone'));
633 $user_settings->setDateFormat((
int) $this->
form->getInput(
'date_format'));
634 $user_settings->setTimeFormat((
int) $this->
form->getInput(
'time_format'));
635 $user_settings->save();
637 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txtlng(
'common',
'msg_obj_modified', $this->user->getLanguage()),
true);
639 $this->
ctrl->redirect($this,
'showGeneralSettings');
642 $this->
form->setValuesByPost();
648 if (!$this->starting_point_repository->isPersonalStartingPointEnabled()
653 $ref_id = $this->
form->getInput(
'usr_start_ref_id');
655 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'obj_ref_id_not_exist'),
true);
664 if (!(
bool) $this->
settings->get(
'user_delete_own_account') ||
666 $this->
ctrl->redirect($this,
'showGeneralSettings');
670 $this->
user->removeDeletionFlag();
674 $this->
tabs->activateTab(
'delacc');
676 $modal = $this->ui_factory->modal()->interruptive(
677 $this->
lng->txt(
'delete_account'),
678 $this->
lng->txt(
'user_delete_own_account_logout_confirmation'),
679 $this->
ctrl->getFormActionByClass(ilPersonalSettingsGUI::class,
'deleteOwnAccountLogout')
680 )->withActionButtonLabel($this->
lng->txt(
'user_delete_own_account_logout_button'));
682 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'user_delete_own_account_info'));
684 $this->ui_factory->button()->standard(
685 $this->
lng->txt(
'btn_next'),
686 $modal->getShowSignal()
690 $this->tpl->setContent($this->ui_renderer->render($modal));
692 $this->tpl->printToStdout();
697 $this->
user->removeDeletionFlag();
699 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'user_delete_own_account_aborted'),
true);
700 $this->
ctrl->redirect($this,
'showGeneralSettings');
705 $this->
user->activateDeletionFlag();
708 $this->auth_session->logout();
710 $this->
ctrl->redirectToURL(
'login.php?cmd=force_login&target=usr_' . md5(
'usrdelown'));
715 if (!(
bool) $this->
settings->get(
'user_delete_own_account') ||
717 !$this->
user->hasDeletionFlag()) {
718 $this->
ctrl->redirect($this,
'showGeneralSettings');
723 $this->
tabs->activateTab(
'delacc');
725 $this->tpl->setOnScreenMessage(
727 $this->
lng->txt(
'user_delete_own_account_final_confirmation')
731 $this->ui_factory->button()->standard(
732 $this->
lng->txt(
'confirm'),
733 $this->
ctrl->getLinkTargetByClass(self::class,
'deleteOwnAccountStep3')
738 $this->ui_factory->button()->standard(
739 $this->
lng->txt(
'cancel'),
740 $this->
ctrl->getLinkTargetByClass(self::class,
'abortDeleteOwnAccount')
743 $this->tpl->printToStdout();
748 if (!(
bool) $this->
settings->get(
'user_delete_own_account') ||
750 !$this->
user->hasDeletionFlag()) {
751 $this->
ctrl->redirect($this,
'showGeneralSettings');
757 $ntf->setLangModules([
'user']);
758 $ntf->addAdditionalInfo(
'profile', $this->
user->getProfileAsString($this->lng),
true);
762 $ntf->setIntroductionDirect(
764 $this->
lng->txt(
'user_delete_own_account_email_body'),
765 $this->
user->getLogin(),
771 $message = $ntf->composeAndGetMessage($this->
user->getId(), null,
'read',
true);
772 $subject = $this->
lng->txt(
'user_delete_own_account_email_subject');
776 $user_email = $this->
user->getEmail();
777 $admin_mail = $this->
settings->get(
'user_delete_own_account_email');
780 $mmail->From($this->mail_sender_factory->system());
782 if ($user_email !==
'') {
783 $mmail->To($user_email);
784 $mmail->Bcc($admin_mail);
785 $mmail->Subject($subject,
true);
788 } elseif ($admin_mail !== null || $admin_mail !==
'') {
789 $mmail->To($admin_mail);
790 $mmail->Subject($subject,
true);
795 $this->log->root()->log(
'Account deleted: ' . $this->
user->getLogin() .
' (' . $this->
user->getId() .
')');
797 $this->
user->delete();
800 $this->auth_session->logout();
801 $this->
ctrl->redirectToURL(
'login.php?accdel=1');
static get(string $a_var)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
An entity that renders components to a string output.
ilUserDefinedFields $user_defined_fields
ilRbacSystem $rbac_system
static _lookupActivatedStyle(string $a_skin, string $a_style)
lookup if a style is activated
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
workWithUserSetting(string $setting)
Additional user data fields definition.
Provides fluid interface to LoggingServices.
const SYSTEM_USER_ID
This file contains constants for PHPStan analyis, see: https://phpstan.org/config-reference#constants...
initGeneralSettingsForm()
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static isPassword(string $a_passwd, ?string &$customError=null)
ilGlobalTemplateInterface $tpl
showPassword(bool $a_no_init=false, bool $hide_form=false)
static _getShortTimeZoneList()
get short timezone list
static secondsToString(int $seconds, bool $force_with_seconds=false, ?ilLanguage $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
static _getInstanceByUserId(int $a_user_id)
static _lookupObjId(int $ref_id)
ilAuthSession $auth_session
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilUserSettingsConfig $user_settings_config
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
ilUserStartingPointRepository $starting_point_repository
static _lookupTitle(int $obj_id)
const START_REPOSITORY_OBJ
ilNavigationHistory $navigation_history
static isPasswordValidForUserContext(string $clear_text_password, $user, ?string &$error_language_variable=null)
string $entered_current_password
string $entered_new_password
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()
Last visited history for repository items.
static redirect(string $a_script)
const SUGGESTED_LEAD_TIME
ilStyleDefinition $style_definition
GUI class for personal profile.
form( $class_path, string $cmd, string $submit_caption="")
checkPersonalStartingPoint()
allowPasswordChange()
Check, whether password change is allowed for user.
ilMailMimeSenderFactory $mail_sender_factory
static setClosingContext(int $a_context)
set closing context (for statistics)
executeCommand()
execute command
static getMailObjectRefId()
ilStyleDefinition acts as a wrapper of style related actions.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
userSettingVisible(string $setting)
static _lookupEntry(string $a_lang_key, string $a_mod, string $a_id)
userSettingEnabled(string $setting)
static _lookupType(int $id, bool $reference=false)
static setUseRelativeDates(bool $a_status)
set use relative dates
static getSessionExpireValue()
Returns the session expiration value.
static isPasswordModificationEnabled($a_authmode)
Check if password modification is enabled.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance()
Singleton method to reduce footprint (included files, created instances)
static set(string $a_var, $a_val)
Set a value.
initSubTabs(string $a_cmd)
showGeneralSettings(bool $a_no_init=false)