ILIAS  release_7 Revision v7.30-3-g800a261c036
ilPasswordAssistanceGUI Class Reference

Password assistance facility for users who have forgotten their password or for users for whom no password has been assigned yet. More...

+ Collaboration diagram for ilPasswordAssistanceGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 showAssistanceForm (ilPropertyFormGUI $form=null)
 
 submitAssistanceForm ()
 Reads the submitted data from the password assistance form. More...
 
 showAssignPasswordForm (ilPropertyFormGUI $form=null, $pwassist_id='')
 Assign password form. More...
 
 submitAssignPasswordForm ()
 Reads the submitted data from the password assistance form. More...
 
 showUsernameAssistanceForm (ilPropertyFormGUI $form=null)
 Shows the password assistance form. More...
 
 submitUsernameAssistanceForm ()
 Reads the submitted data from the password assistance form. More...
 
 showMessageForm ($text, string $permanent_link_context)
 This form is used to show a message to the user. More...
 

Data Fields

const PERMANENT_LINK_TARGET_PW = 'pwassist'
 
const PERMANENT_LINK_TARGET_NAME = 'nameassist'
 

Protected Member Functions

 getBaseUrl ()
 Returns the ILIAS http path without a trailing /. More...
 
 buildUrl (string $script, array $queryParameters)
 
 getAssistanceForm ()
 
 getAssignPasswordForm ($pwassist_id)
 
 getUsernameAssistanceForm ()
 
 fillPermanentLink ($context)
 

Protected Attributes

 $ctrl
 
 $lng
 
 $rbacreview
 
 $tpl
 
 $settings
 
 $ilias
 

Private Attributes

 $ilErr
 
 $help
 
 $actor
 

Detailed Description

Password assistance facility for users who have forgotten their password or for users for whom no password has been assigned yet.

Author
Werner Randelshofer wrand.nosp@m.els@.nosp@m.hsw.f.nosp@m.hz.c.nosp@m.h
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 12 of file class.ilPasswordAssistanceGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPasswordAssistanceGUI::__construct ( )

Definition at line 62 of file class.ilPasswordAssistanceGUI.php.

63 {
64 global $DIC;
65
66 $this->ctrl = $DIC->ctrl();
67 $this->lng = $DIC->language();
68 $this->rbacreview = $DIC->rbac()->review();
69 $this->tpl = $DIC->ui()->mainTemplate();
70 $this->settings = $DIC->settings();
71 $this->ilias = $DIC['ilias'];
72 $this->ilErr = $DIC['ilErr'];
73 $this->help = $DIC->help();
74 $this->actor = $DIC->user();
75
76 $this->help->setScreenIdComponent('init');
77 }
global $DIC
Definition: goto.php:24
help()
Definition: help.php:2
redirection script todo: (a better solution should control the processing via a xml file)
settings()
Definition: settings.php:2

References $DIC, help(), and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildUrl()

ilPasswordAssistanceGUI::buildUrl ( string  $script,
array  $queryParameters 
)
protected
Parameters
string$script
array$queryParameters
Returns
string

Definition at line 137 of file class.ilPasswordAssistanceGUI.php.

137 : string
138 {
139 $url = implode('/', [
140 $this->getBaseUrl(),
141 ltrim($script, '/')
142 ]);
143
145 $url,
146 http_build_query($queryParameters, null, '&')
147 );
148
149 return $url;
150 }
getBaseUrl()
Returns the ILIAS http path without a trailing /.
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
$url

References $url, ilUtil\appendUrlParameterString(), and getBaseUrl().

+ Here is the call graph for this function:

◆ executeCommand()

ilPasswordAssistanceGUI::executeCommand ( )
Returns
mixed

Definition at line 82 of file class.ilPasswordAssistanceGUI.php.

83 {
84 // check hack attempts
85 if (!$this->settings->get('setup_ok')) {
86 $this->ilErr->raiseError('Setup is not completed. Please run setup routine again.', $this->ilErr->FATAL);
87 }
88
89 if (!$this->settings->get('password_assistance')) {
90 $this->ilErr->raiseError($this->lng->txt('permission_denied'), $this->ilErr->MESSAGE);
91 }
92
93 if ($this->actor->getId() > 0 && !$this->actor->isAnonymous()) {
94 $this->ilErr->raiseError($this->lng->txt('permission_denied'), $this->ilErr->MESSAGE);
95 }
96
97 // Change the language, if necessary.
98 // And load the 'pwassist' language module
99 $lang = $_GET['lang'];
100 if ($lang != null && $lang != '' && $this->lng->getLangKey() != $lang) {
101 $lng = new ilLanguage($lang);
102 }
103 $this->lng->loadLanguageModule('pwassist');
104
105 $cmd = $this->ctrl->getCmd();
106 $next_class = $this->ctrl->getNextClass($this);
107
108 switch ($next_class) {
109 default:
110 if ($cmd != '' && method_exists($this, $cmd)) {
111 return $this->$cmd();
112 } else {
113 if (!empty($_GET['key'])) {
114 $this->showAssignPasswordForm();
115 } else {
116 $this->showAssistanceForm();
117 }
118 }
119 break;
120 }
121 }
$_GET["client_id"]
language handling
showAssistanceForm(ilPropertyFormGUI $form=null)
showAssignPasswordForm(ilPropertyFormGUI $form=null, $pwassist_id='')
Assign password form.
$lang
Definition: xapiexit.php:8

References $_GET, $lang, $lng, settings(), showAssignPasswordForm(), and showAssistanceForm().

+ Here is the call graph for this function:

◆ fillPermanentLink()

ilPasswordAssistanceGUI::fillPermanentLink (   $context)
protected
Parameters
string$context

Definition at line 739 of file class.ilPasswordAssistanceGUI.php.

740 {
741 $this->tpl->setPermanentLink('usr', null, $context);
742 }
$context
Definition: webdav.php:26

References $context.

Referenced by showAssignPasswordForm(), showAssistanceForm(), and showMessageForm().

+ Here is the caller graph for this function:

◆ getAssignPasswordForm()

ilPasswordAssistanceGUI::getAssignPasswordForm (   $pwassist_id)
protected
Parameters
string$pwassist_id
Returns
ilPropertyFormGUI

Definition at line 385 of file class.ilPasswordAssistanceGUI.php.

386 {
387 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
388 $form = new ilPropertyFormGUI();
389
390 $form->setFormAction($this->ctrl->getFormAction($this, 'submitAssignPasswordForm'));
391 $form->setTarget('_parent');
392
393 $username = new ilTextInputGUI($this->lng->txt('username'), 'username');
394 $username->setRequired(true);
395 $form->addItem($username);
396
397 $password = new ilPasswordInputGUI($this->lng->txt('password'), 'password');
399 $password->setRequired(true);
400 $password->setUseStripSlashes(false);
401 $form->addItem($password);
402
403 $key = new ilHiddenInputGUI('key');
404 $key->setValue($pwassist_id);
405 $form->addItem($key);
406
407 $form->addCommandButton('submitAssignPasswordForm', $this->lng->txt('submit'));
408
409 return $form;
410 }
This class represents a hidden form property in a property form.
This class represents a password property in a property form.
This class represents a property form user interface.
This class represents a text property in a property form.
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()
$password
Definition: cron.php:14

References $password, and ilUtil\getPasswordRequirementsInfo().

Referenced by showAssignPasswordForm(), and submitAssignPasswordForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAssistanceForm()

ilPasswordAssistanceGUI::getAssistanceForm ( )
protected
Returns
ilPropertyFormGUI

Definition at line 155 of file class.ilPasswordAssistanceGUI.php.

156 {
157 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
158 $form = new ilPropertyFormGUI();
159
160 $form->setFormAction($this->ctrl->getFormAction($this, 'submitAssistanceForm'));
161 $form->setTarget('_parent');
162
163 $username = new ilTextInputGUI($this->lng->txt('username'), 'username');
164 $username->setRequired(true);
165 $form->addItem($username);
166
167 $email = new ilEMailInputGUI($this->lng->txt('email'), 'email');
168 $email->setRequired(true);
169 $form->addItem($email);
170
171 $form->addCommandButton('submitAssistanceForm', $this->lng->txt('submit'));
172
173 return $form;
174 }
This class represents a email property in a property form.
if( $orgName !==null) if($spconfig->hasValue('contacts')) $email
Definition: metadata.php:285

References $email.

Referenced by showAssistanceForm(), and submitAssistanceForm().

+ Here is the caller graph for this function:

◆ getBaseUrl()

ilPasswordAssistanceGUI::getBaseUrl ( )
protected

Returns the ILIAS http path without a trailing /.

Returns
string

Definition at line 127 of file class.ilPasswordAssistanceGUI.php.

127 : string
128 {
129 return rtrim(ILIAS_HTTP_PATH, '/');
130 }

Referenced by buildUrl().

+ Here is the caller graph for this function:

◆ getUsernameAssistanceForm()

ilPasswordAssistanceGUI::getUsernameAssistanceForm ( )
protected
Returns
ilPropertyFormGUI

Definition at line 569 of file class.ilPasswordAssistanceGUI.php.

570 {
571 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
572 $form = new ilPropertyFormGUI();
573
574 $form->setFormAction($this->ctrl->getFormAction($this, 'submitUsernameAssistanceForm'));
575 $form->setTarget('_parent');
576
577 $email = new ilTextInputGUI($this->lng->txt('email'), 'email');
578 $email->setRequired(true);
579 $form->addItem($email);
580
581 $form->addCommandButton('submitUsernameAssistanceForm', $this->lng->txt('submit'));
582
583 return $form;
584 }

References $email.

Referenced by showUsernameAssistanceForm(), and submitUsernameAssistanceForm().

+ Here is the caller graph for this function:

◆ showAssignPasswordForm()

ilPasswordAssistanceGUI::showAssignPasswordForm ( ilPropertyFormGUI  $form = null,
  $pwassist_id = '' 
)

Assign password form.

This form is used to assign a password to a username. To use this form, the following data must be provided as HTTP GET parameter, or in argument pwassist_id: key The key is used to retrieve the password assistance session. If the key is missing, or if the password assistance session has expired, the password assistance form will be shown instead of this form.

Parameters
ilPropertyFormGUI$form
string$pwassist_id

Definition at line 424 of file class.ilPasswordAssistanceGUI.php.

425 {
426 require_once 'include/inc.pwassist_session_handler.php';
427 require_once 'Services/Language/classes/class.ilLanguage.php';
428
429 $this->help->setSubScreenId('password_input');
430
431 // Retrieve form data
432 if (!$pwassist_id) {
433 $pwassist_id = $_GET['key'];
434 }
435
436 // Retrieve the session, and check if it is valid
437 $pwassist_session = db_pwassist_session_read($pwassist_id);
438 if (
439 !is_array($pwassist_session) ||
440 count($pwassist_session) == 0 ||
441 $pwassist_session['expires'] < time()
442 ) {
443 ilUtil::sendFailure($this->lng->txt('pwassist_session_expired'));
444 $this->showAssistanceForm(null);
445 } else {
446 $tpl = ilStartUpGUI::initStartUpTemplate('tpl.pwassist_assignpassword.html', true);
447 $tpl->setVariable('IMG_PAGEHEADLINE', ilUtil::getImagePath('icon_auth.svg'));
448 $tpl->setVariable('TXT_PAGEHEADLINE', $this->lng->txt('password_assistance'));
449
450 $tpl->setVariable('TXT_ENTER_USERNAME_AND_NEW_PASSWORD', $this->lng->txt('pwassist_enter_username_and_new_password'));
451
452 if (!$form) {
453 $form = $this->getAssignPasswordForm($pwassist_id);
454 }
455 $tpl->setVariable('FORM', $form->getHTML());
456 $this->fillPermanentLink(self::PERMANENT_LINK_TARGET_PW);
458 }
459 }
static printToGlobalTemplate($tpl)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
db_pwassist_session_read($pwassist_id)

References $_GET, $tpl, db_pwassist_session_read(), fillPermanentLink(), getAssignPasswordForm(), ilUtil\getImagePath(), help(), ilStartUpGUI\printToGlobalTemplate(), ilUtil\sendFailure(), and showAssistanceForm().

Referenced by executeCommand(), and submitAssignPasswordForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showAssistanceForm()

ilPasswordAssistanceGUI::showAssistanceForm ( ilPropertyFormGUI  $form = null)
Parameters
ilPropertyFormGUI$form

Definition at line 179 of file class.ilPasswordAssistanceGUI.php.

180 {
181 $this->help->setSubScreenId('password_assistance');
182
183 $tpl = ilStartUpGUI::initStartUpTemplate('tpl.pwassist_assistance.html', true);
184 $tpl->setVariable('IMG_PAGEHEADLINE', ilUtil::getImagePath('icon_auth.svg'));
185 $tpl->setVariable('TXT_PAGEHEADLINE', $this->lng->txt('password_assistance'));
186
187 $tpl->setVariable(
188 'TXT_ENTER_USERNAME_AND_EMAIL',
189 str_replace(
190 "\\n",
191 '<br />',
192 sprintf(
193 $this->lng->txt('pwassist_enter_username_and_email'),
194 '<a href="mailto:' . ilUtil::prepareFormOutput($this->settings->get('admin_email')) . '">' . ilUtil::prepareFormOutput($this->settings->get('admin_email')) . '</a>'
195 )
196 )
197 );
198
199 if (!$form) {
200 $form = $this->getAssistanceForm();
201 }
202 $tpl->setVariable('FORM', $form->getHTML());
203 $this->fillPermanentLink(self::PERMANENT_LINK_TARGET_PW);
205 }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public

References $tpl, fillPermanentLink(), getAssistanceForm(), ilUtil\getImagePath(), help(), ilUtil\prepareFormOutput(), and ilStartUpGUI\printToGlobalTemplate().

Referenced by executeCommand(), showAssignPasswordForm(), submitAssignPasswordForm(), and submitAssistanceForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showMessageForm()

ilPasswordAssistanceGUI::showMessageForm (   $text,
string  $permanent_link_context 
)

This form is used to show a message to the user.

Parameters
string$text

Definition at line 725 of file class.ilPasswordAssistanceGUI.php.

726 {
727 $tpl = ilStartUpGUI::initStartUpTemplate('tpl.pwassist_message.html', true);
728 $tpl->setVariable('TXT_PAGEHEADLINE', $this->lng->txt('password_assistance'));
729 $tpl->setVariable('IMG_PAGEHEADLINE', ilUtil::getImagePath('icon_auth.svg'));
730
731 $tpl->setVariable('TXT_TEXT', str_replace("\\n", '<br />', $text));
732 $this->fillPermanentLink($permanent_link_context);
734 }

References $tpl, fillPermanentLink(), ilUtil\getImagePath(), and ilStartUpGUI\printToGlobalTemplate().

Referenced by submitAssignPasswordForm(), submitAssistanceForm(), and submitUsernameAssistanceForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showUsernameAssistanceForm()

ilPasswordAssistanceGUI::showUsernameAssistanceForm ( ilPropertyFormGUI  $form = null)

Shows the password assistance form.

This form is used to request a password assistance mail from ILIAS. This form contains the following fields: username email When the user submits the form, then this script is invoked with the cmd 'submitAssistanceForm'.

Parameters
ilPropertyFormGUI$form

Definition at line 596 of file class.ilPasswordAssistanceGUI.php.

597 {
598 $this->help->setSubScreenId('username_assistance');
599
600 $tpl = ilStartUpGUI::initStartUpTemplate('tpl.pwassist_username_assistance.html', true);
601 $tpl->setVariable('IMG_PAGEHEADLINE', ilUtil::getImagePath('icon_auth.svg'));
602 $tpl->setVariable('TXT_PAGEHEADLINE', $this->lng->txt('password_assistance'));
603
604 $tpl->setVariable(
605 'TXT_ENTER_USERNAME_AND_EMAIL',
606 str_replace(
607 "\\n",
608 '<br />',
609 sprintf(
610 $this->lng->txt('pwassist_enter_email'),
611 '<a href="mailto:' . ilUtil::prepareFormOutput($this->settings->get('admin_email')) . '">' . ilUtil::prepareFormOutput($this->settings->get('admin_email')) . '</a>'
612 )
613 )
614 );
615
616 if (!$form) {
617 $form = $this->getUsernameAssistanceForm();
618 }
619 $tpl->setVariable('FORM', $form->getHTML());
620 //$this->fillPermanentLink(self::PERMANENT_LINK_TARGET_NAME);
622 }

References $tpl, ilUtil\getImagePath(), getUsernameAssistanceForm(), help(), ilUtil\prepareFormOutput(), and ilStartUpGUI\printToGlobalTemplate().

Referenced by submitUsernameAssistanceForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ submitAssignPasswordForm()

ilPasswordAssistanceGUI::submitAssignPasswordForm ( )

Reads the submitted data from the password assistance form.

The following form fields are read as HTTP POST parameters: key username password1 password2 The key is used to retrieve the password assistance session. If the key is missing, or if the password assistance session has expired, the password assistance form will be shown instead of this form. If the password assistance session is valid, and if the username matches the username, for which the password assistance has been requested, and if the new password is valid, ILIAS assigns the password to the user. Note: To prevent replay attacks, the session is deleted when the password has been assigned successfully.

Definition at line 477 of file class.ilPasswordAssistanceGUI.php.

478 {
479 require_once 'include/inc.pwassist_session_handler.php';
480
481 // We need to fetch this before form instantiation
482 $pwassist_id = ilUtil::stripSlashes($_POST['key']);
483
484 $form = $this->getAssignPasswordForm($pwassist_id);
485 if (!$form->checkInput()) {
486 $form->setValuesByPost();
487 $this->showAssignPasswordForm($form, $pwassist_id);
488 return;
489 }
490
491 $username = $form->getInput('username');
492 $password = $form->getInput('password');
493 $pwassist_id = $form->getInput('key');
494
495 // Retrieve the session
496 $pwassist_session = db_pwassist_session_read($pwassist_id);
497
498 if (
499 !is_array($pwassist_session) ||
500 count($pwassist_session) == 0 ||
501 $pwassist_session['expires'] < time()
502 ) {
503 ilUtil::sendFailure(str_replace("\\n", '', $this->lng->txt('pwassist_session_expired')));
504 $form->setValuesByPost();
505 $this->showAssistanceForm($form);
506 return;
507 } else {
508 $is_successful = true;
509 $message = '';
510
511 $userObj = \ilObjectFactory::getInstanceByObjId($pwassist_session['user_id'], false);
512 if (!$userObj || !($userObj instanceof \ilObjUser)) {
513 $message = $this->lng->txt('user_does_not_exist');
514 $is_successful = false;
515 }
516
517 // check if the username entered by the user matches the
518 // one of the user object.
519 if ($is_successful && strcasecmp($userObj->getLogin(), $username) != 0) {
520 $message = $this->lng->txt('pwassist_login_not_match');
521 $is_successful = false;
522 }
523
524 $error_lng_var = '';
525 if (!ilUtil::isPasswordValidForUserContext($password, $userObj, $error_lng_var)) {
526 $message = $this->lng->txt($error_lng_var);
527 $is_successful = false;
528 }
529
530 // End of validation
531 // If the validation was successful, we change the password of the
532 // user.
533 // ------------------
534 if ($is_successful) {
535 $is_successful = $userObj->resetPassword($password, $password);
536 if (!$is_successful) {
537 $message = $this->lng->txt('passwd_invalid');
538 }
539 }
540
541 // If we are successful so far, we update the user object.
542 // ------------------
543 if ($is_successful) {
544 $userObj->setLastPasswordChangeToNow();
545 $userObj->update();
546 }
547
548 // If we are successful, we destroy the password assistance
549 // session and redirect to the login page.
550 // Else we display the form again along with an error message.
551 // ------------------
552 if ($is_successful) {
553 db_pwassist_session_destroy($pwassist_id);
554 $this->showMessageForm(
555 sprintf($this->lng->txt('pwassist_password_assigned'), $username),
556 self::PERMANENT_LINK_TARGET_PW
557 );
558 } else {
559 ilUtil::sendFailure(str_replace("\\n", '', $message));
560 $form->setValuesByPost();
561 $this->showAssignPasswordForm($form, $pwassist_id);
562 }
563 }
564 }
$_POST["username"]
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
showMessageForm($text, string $permanent_link_context)
This form is used to show a message to the user.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static isPasswordValidForUserContext($clear_text_password, $user, &$error_language_variable=null)
db_pwassist_session_destroy($pwassist_id)
destroy session
$message
Definition: xapiexit.php:14

References $_POST, $message, $password, db_pwassist_session_destroy(), db_pwassist_session_read(), getAssignPasswordForm(), ilObjectFactory\getInstanceByObjId(), ilObjUser\getLogin(), ilUtil\isPasswordValidForUserContext(), ilUtil\sendFailure(), ilObjUser\setLastPasswordChangeToNow(), showAssignPasswordForm(), showAssistanceForm(), showMessageForm(), ilUtil\stripSlashes(), and ilObject\update().

+ Here is the call graph for this function:

◆ submitAssistanceForm()

ilPasswordAssistanceGUI::submitAssistanceForm ( )

Reads the submitted data from the password assistance form.

The following form fields are read as HTTP POST parameters: username email If the submitted username and email address matches an entry in the user data table, then ILIAS creates a password assistance session for the user, and sends a password assistance mail to the email address. For details about the creation of the session and the e-mail see function sendPasswordAssistanceMail().

Definition at line 218 of file class.ilPasswordAssistanceGUI.php.

219 {
220 $form = $this->getAssistanceForm();
221 if (!$form->checkInput()) {
222 $form->setValuesByPost();
223 $this->showAssistanceForm($form);
224 return;
225 }
226
227 $username = $form->getInput('username');
228 $email = trim($form->getInput('email'));
229
230 $usrId = \ilObjUser::getUserIdByLogin($username);
231 if (!is_numeric($usrId) || !($usrId > 0)) {
232 \ilLoggerFactory::getLogger('usr')->info(sprintf(
233 'Could not process password assistance form (reason: no user found) %s / %s',
234 $username,
235 $email
236 ));
237
238 $this->showMessageForm(
239 sprintf($this->lng->txt('pwassist_mail_sent'), $email),
240 self::PERMANENT_LINK_TARGET_PW
241 );
242 return;
243 }
244
245 $defaultAuth = AUTH_LOCAL;
246 if ($GLOBALS['DIC']['ilSetting']->get('auth_mode')) {
247 $defaultAuth = $GLOBALS['DIC']['ilSetting']->get('auth_mode');
248 }
249
250 $user = new \ilObjUser($usrId);
251 $emailAddresses = array_map('strtolower', [$user->getEmail(), $user->getSecondEmail()]);
252
253 if (!in_array(strtolower($email), $emailAddresses)) {
254 if (0 === strlen(implode('', $emailAddresses))) {
255 \ilLoggerFactory::getLogger('usr')->info(sprintf(
256 'Could not process password assistance form (reason: account without email addresses): %s / %s',
257 $username,
258 $email
259 ));
260 } else {
261 \ilLoggerFactory::getLogger('usr')->info(sprintf(
262 'Could not process password assistance form (reason: account email addresses differ from input): %s / %s',
263 $username,
264 $email
265 ));
266 }
267 } elseif (
268 (
269 $user->getAuthMode(true) != AUTH_LOCAL ||
270 ($user->getAuthMode(true) == $defaultAuth && $defaultAuth != AUTH_LOCAL)
271 ) && !(
272 $user->getAuthMode(true) == AUTH_SAML
273 )
274 ) {
275 \ilLoggerFactory::getLogger('usr')->info(sprintf(
276 'Could not process password assistance form (reason: not permitted for accounts using external authentication sources): %s / %s',
277 $username,
278 $email
279 ));
280 } elseif (
281 $this->rbacreview->isAssigned($user->getId(), ANONYMOUS_ROLE_ID) ||
282 $this->rbacreview->isAssigned($user->getId(), SYSTEM_ROLE_ID)
283 ) {
284 \ilLoggerFactory::getLogger('usr')->info(sprintf(
285 'Could not process password assistance form (reason: not permitted for system user or anonymous): %s / %s',
286 $username,
287 $email
288 ));
289 } else {
290 $this->sendPasswordAssistanceMail($user);
291 }
292
293 $this->showMessageForm(
294 sprintf($this->lng->txt('pwassist_mail_sent'), $email),
295 self::PERMANENT_LINK_TARGET_PW
296 );
297 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
const AUTH_SAML
const AUTH_LOCAL
static getLogger($a_component_id)
Get component logger.
static getUserIdByLogin($a_login)
const SYSTEM_ROLE_ID
Definition: constants.php:27
const ANONYMOUS_ROLE_ID
Definition: constants.php:26

References $email, $GLOBALS, ANONYMOUS_ROLE_ID, AUTH_LOCAL, AUTH_SAML, getAssistanceForm(), ilLoggerFactory\getLogger(), ilObjUser\getUserIdByLogin(), showAssistanceForm(), showMessageForm(), and SYSTEM_ROLE_ID.

+ Here is the call graph for this function:

◆ submitUsernameAssistanceForm()

ilPasswordAssistanceGUI::submitUsernameAssistanceForm ( )

Reads the submitted data from the password assistance form.

The following form fields are read as HTTP POST parameters: username email If the submitted username and email address matches an entry in the user data table, then ILIAS creates a password assistance session for the user, and sends a password assistance mail to the email address. For details about the creation of the session and the e-mail see function sendPasswordAssistanceMail().

Definition at line 635 of file class.ilPasswordAssistanceGUI.php.

636 {
637 require_once 'Services/User/classes/class.ilObjUser.php';
638 require_once 'Services/Utilities/classes/class.ilUtil.php';
639
640 $form = $this->getUsernameAssistanceForm();
641 if (!$form->checkInput()) {
642 $form->setValuesByPost();
643 $this->showUsernameAssistanceForm($form);
644
645 return;
646 }
647
648 $email = trim($form->getInput('email'));
650
651 if (is_array($logins) && count($logins) > 0) {
652 $this->sendUsernameAssistanceMail($email, $logins);
653 } else {
654 \ilLoggerFactory::getLogger('usr')->info(sprintf(
655 'Could not sent username assistance emails to (reason: no user found): %s',
656 $email
657 ));
658 }
659
660 $this->showMessageForm(
661 $this->lng->txt('pwassist_mail_sent_generic'),
662 self::PERMANENT_LINK_TARGET_NAME
663 );
664 }
static getUserLoginsByEmail($a_email)
get all user login names of an email address
showUsernameAssistanceForm(ilPropertyFormGUI $form=null)
Shows the password assistance form.

References $email, ilLoggerFactory\getLogger(), ilObjUser\getUserLoginsByEmail(), getUsernameAssistanceForm(), showMessageForm(), and showUsernameAssistanceForm().

+ Here is the call graph for this function:

Field Documentation

◆ $actor

ilPasswordAssistanceGUI::$actor
private

Definition at line 60 of file class.ilPasswordAssistanceGUI.php.

◆ $ctrl

ilPasswordAssistanceGUI::$ctrl
protected

Definition at line 20 of file class.ilPasswordAssistanceGUI.php.

◆ $help

ilPasswordAssistanceGUI::$help
private

Definition at line 55 of file class.ilPasswordAssistanceGUI.php.

◆ $ilErr

ilPasswordAssistanceGUI::$ilErr
private

Definition at line 50 of file class.ilPasswordAssistanceGUI.php.

◆ $ilias

ilPasswordAssistanceGUI::$ilias
protected

Definition at line 45 of file class.ilPasswordAssistanceGUI.php.

◆ $lng

ilPasswordAssistanceGUI::$lng
protected

Definition at line 25 of file class.ilPasswordAssistanceGUI.php.

Referenced by executeCommand().

◆ $rbacreview

ilPasswordAssistanceGUI::$rbacreview
protected

Definition at line 30 of file class.ilPasswordAssistanceGUI.php.

◆ $settings

ilPasswordAssistanceGUI::$settings
protected

Definition at line 40 of file class.ilPasswordAssistanceGUI.php.

◆ $tpl

ilPasswordAssistanceGUI::$tpl
protected

◆ PERMANENT_LINK_TARGET_NAME

const ilPasswordAssistanceGUI::PERMANENT_LINK_TARGET_NAME = 'nameassist'

Definition at line 15 of file class.ilPasswordAssistanceGUI.php.

◆ PERMANENT_LINK_TARGET_PW

const ilPasswordAssistanceGUI::PERMANENT_LINK_TARGET_PW = 'pwassist'

Definition at line 14 of file class.ilPasswordAssistanceGUI.php.


The documentation for this class was generated from the following file: