ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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

 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)
 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

 getAssistanceForm ()
 
 getAssignPasswordForm ($pwassist_id)
 
 getUsernameAssistanceForm ()
 
 fillPermanentLink ($context)
 

Protected Attributes

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

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.

Member Function Documentation

◆ executeCommand()

ilPasswordAssistanceGUI::executeCommand ( )
Returns
mixed

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

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

81  {
82  // check hack attempts
83  if (!$this->settings->get('password_assistance')) { // || AUTH_DEFAULT != AUTH_LOCAL)
84  //
85  #if(empty($_SESSION['AccountId']) && $_SESSION['AccountId'] !== false)
86  {
87  #$this->ilias->error_obj->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->WARNING);
88  }
89  }
90 
91  // check correct setup
92  if (!$this->settings->get('setup_ok')) {
93  die('Setup is not completed. Please run setup routine again.');
94  }
95 
96  // Change the language, if necessary.
97  // And load the 'pwassist' language module
98  $lang = $_GET['lang'];
99  if ($lang != null && $lang != '' && $this->lng->getLangKey() != $lang) {
100  $lng = new ilLanguage($lang);
101  }
102  $this->lng->loadLanguageModule('pwassist');
103 
104  $cmd = $this->ctrl->getCmd();
105  $next_class = $this->ctrl->getNextClass($this);
106 
107  switch ($next_class) {
108  default:
109  if ($cmd != '') {
110  return $this->$cmd();
111  } else {
112  if (!empty($_GET['key'])) {
113  $this->showAssignPasswordForm();
114  } else {
115  $this->showAssistanceForm();
116  }
117  }
118  break;
119  }
120  }
$_GET["client_id"]
showAssignPasswordForm(ilPropertyFormGUI $form=null, $pwassist_id='')
Assign password form.
showAssistanceForm(ilPropertyFormGUI $form=null)
settings()
Definition: settings.php:2
language handling
+ Here is the call graph for this function:

◆ fillPermanentLink()

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

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

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

700  {
701  $this->tpl->setPermanentLink('usr', null, $context);
702  }
+ Here is the caller graph for this function:

◆ getAssignPasswordForm()

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

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

References $form, $key, $password, and ilFormPropertyGUI\setRequired().

Referenced by showAssignPasswordForm(), and submitAssignPasswordForm().

338  {
339  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
340  $form = new ilPropertyFormGUI();
341 
342  $form->setFormAction($this->ctrl->getFormAction($this, 'submitAssignPasswordForm'));
343  $form->setTarget('_parent');
344 
345  $username = new ilTextInputGUI($this->lng->txt('username'), 'username');
346  $username->setRequired(true);
347  $form->addItem($username);
348 
349  $password = new ilPasswordInputGUI($this->lng->txt('password'), 'password');
350  $password->setRequired(true);
351  $form->addItem($password);
352 
353  $key = new ilHiddenInputGUI('key');
354  $key->setValue($pwassist_id);
355  $form->addItem($key);
356 
357  $form->addCommandButton('submitAssignPasswordForm', $this->lng->txt('submit'));
358 
359  return $form;
360  }
This class represents a property form user interface.
$password
Definition: pwgen.php:17
This class represents a hidden form property in a property form.
if(isset($_POST['submit'])) $form
This class represents a text property in a property form.
This class represents a password property in a property form.
$key
Definition: croninfo.php:18
setRequired($a_required)
Set Required.
+ 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 125 of file class.ilPasswordAssistanceGUI.php.

References $email, $form, and ilFormPropertyGUI\setRequired().

Referenced by showAssistanceForm(), and submitAssistanceForm().

126  {
127  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
128  $form = new ilPropertyFormGUI();
129 
130  $form->setFormAction($this->ctrl->getFormAction($this, 'submitAssistanceForm'));
131  $form->setTarget('_parent');
132 
133  $username = new ilTextInputGUI($this->lng->txt('username'), 'username');
134  $username->setRequired(true);
135  $form->addItem($username);
136 
137  $email = new ilTextInputGUI($this->lng->txt('email'), 'email');
138  $email->setRequired(true);
139  $form->addItem($email);
140 
141  $form->addCommandButton('submitAssistanceForm', $this->lng->txt('submit'));
142 
143  return $form;
144  }
if($orgName !==null) if($spconfig->hasValue('contacts')) $email
Definition: metadata.php:193
This class represents a property form user interface.
if(isset($_POST['submit'])) $form
This class represents a text property in a property form.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUsernameAssistanceForm()

ilPasswordAssistanceGUI::getUsernameAssistanceForm ( )
protected
Returns
ilPropertyFormGUI

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

References $email, and $form.

Referenced by showUsernameAssistanceForm(), and submitUsernameAssistanceForm().

514  {
515  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
516  $form = new ilPropertyFormGUI();
517 
518  $form->setFormAction($this->ctrl->getFormAction($this, 'submitUsernameAssistanceForm'));
519  $form->setTarget('_parent');
520 
521  $email = new ilTextInputGUI($this->lng->txt('email'), 'email');
522  $email->setRequired(true);
523  $form->addItem($email);
524 
525  $form->addCommandButton('submitUsernameAssistanceForm', $this->lng->txt('submit'));
526 
527  return $form;
528  }
if($orgName !==null) if($spconfig->hasValue('contacts')) $email
Definition: metadata.php:193
This class represents a property form user interface.
if(isset($_POST['submit'])) $form
This class represents a text property in a property form.
+ 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 374 of file class.ilPasswordAssistanceGUI.php.

References $_GET, $form, db_pwassist_session_read(), fillPermanentLink(), getAssignPasswordForm(), ilUtil\getImagePath(), ilUtil\sendFailure(), showAssistanceForm(), and time.

Referenced by executeCommand(), and submitAssignPasswordForm().

375  {
376  require_once 'include/inc.pwassist_session_handler.php';
377  require_once 'Services/Language/classes/class.ilLanguage.php';
378 
379  // Retrieve form data
380  if (!$pwassist_id) {
381  $pwassist_id = $_GET['key'];
382  }
383 
384  // Retrieve the session, and check if it is valid
385  $pwassist_session = db_pwassist_session_read($pwassist_id);
386  if (
387  !is_array($pwassist_session) ||
388  count($pwassist_session) == 0 ||
389  $pwassist_session['expires'] < time()
390  ) {
391  ilUtil::sendFailure($this->lng->txt('pwassist_session_expired'));
392  $this->showAssistanceForm(null);
393  } else {
394  ilStartUpGUI::initStartUpTemplate('tpl.pwassist_assignpassword.html', true);
395  $this->tpl->setVariable('IMG_PAGEHEADLINE', ilUtil::getImagePath('icon_auth.svg'));
396  $this->tpl->setVariable('TXT_PAGEHEADLINE', $this->lng->txt('password_assistance'));
397 
398  $this->tpl->setVariable('TXT_ENTER_USERNAME_AND_NEW_PASSWORD', $this->lng->txt('pwassist_enter_username_and_new_password'));
399 
400  if (!$form) {
401  $form = $this->getAssignPasswordForm($pwassist_id);
402  }
403  $this->tpl->setVariable('FORM', $form->getHTML());
404  $this->fillPermanentLink(self::PERMANENT_LINK_TARGET_PW);
405  $this->tpl->show();
406  }
407  }
db_pwassist_session_read($pwassist_id)
$_GET["client_id"]
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
showAssistanceForm(ilPropertyFormGUI $form=null)
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ 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 149 of file class.ilPasswordAssistanceGUI.php.

References $form, fillPermanentLink(), getAssistanceForm(), ilUtil\getImagePath(), ilUtil\prepareFormOutput(), and settings().

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

150  {
151  ilStartUpGUI::initStartUpTemplate('tpl.pwassist_assistance.html', true);
152  $this->tpl->setVariable('IMG_PAGEHEADLINE', ilUtil::getImagePath('icon_auth.svg'));
153  $this->tpl->setVariable('TXT_PAGEHEADLINE', $this->lng->txt('password_assistance'));
154 
155  $this->tpl->setVariable(
156  'TXT_ENTER_USERNAME_AND_EMAIL',
157  str_replace(
158  "\\n",
159  '<br />',
160  sprintf(
161  $this->lng->txt('pwassist_enter_username_and_email'),
162  '<a href="mailto:' . ilUtil::prepareFormOutput($this->settings->get('admin_email')) . '">' . ilUtil::prepareFormOutput($this->settings->get('admin_email')) . '</a>'
163  )
164  )
165  );
166 
167  if (!$form) {
168  $form = $this->getAssistanceForm();
169  }
170  $this->tpl->setVariable('FORM', $form->getHTML());
171  $this->fillPermanentLink(self::PERMANENT_LINK_TARGET_PW);
172  $this->tpl->show();
173  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
settings()
Definition: settings.php:2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showMessageForm()

ilPasswordAssistanceGUI::showMessageForm (   $text)

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

Parameters
string$text

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

References $text, fillPermanentLink(), and ilUtil\getImagePath().

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

686  {
687  ilStartUpGUI::initStartUpTemplate('tpl.pwassist_message.html', true);
688  $this->tpl->setVariable('TXT_PAGEHEADLINE', $this->lng->txt('password_assistance'));
689  $this->tpl->setVariable('IMG_PAGEHEADLINE', ilUtil::getImagePath('icon_auth.svg'));
690 
691  $this->tpl->setVariable('TXT_TEXT', str_replace("\\n", '<br />', $text));
692  $this->fillPermanentLink(self::PERMANENT_LINK_TARGET_NAME);
693  $this->tpl->show();
694  }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$text
Definition: errorreport.php:18
+ 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 540 of file class.ilPasswordAssistanceGUI.php.

References $form, fillPermanentLink(), ilUtil\getImagePath(), getUsernameAssistanceForm(), ilUtil\prepareFormOutput(), and settings().

Referenced by submitUsernameAssistanceForm().

541  {
542  ilStartUpGUI::initStartUpTemplate('tpl.pwassist_username_assistance.html', true);
543  $this->tpl->setVariable('IMG_PAGEHEADLINE', ilUtil::getImagePath('icon_auth.svg'));
544  $this->tpl->setVariable('TXT_PAGEHEADLINE', $this->lng->txt('password_assistance'));
545 
546  $this->tpl->setVariable(
547  'TXT_ENTER_USERNAME_AND_EMAIL',
548  str_replace(
549  "\\n",
550  '<br />',
551  sprintf(
552  $this->lng->txt('pwassist_enter_email'),
553  '<a href="mailto:' . ilUtil::prepareFormOutput($this->settings->get('admin_email')) . '">' . ilUtil::prepareFormOutput($this->settings->get('admin_email')) . '</a>'
554  )
555  )
556  );
557 
558  if (!$form) {
559  $form = $this->getUsernameAssistanceForm();
560  }
561  $this->tpl->setVariable('FORM', $form->getHTML());
562  $this->fillPermanentLink(self::PERMANENT_LINK_TARGET_NAME);
563  $this->tpl->show();
564  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
settings()
Definition: settings.php:2
+ 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 425 of file class.ilPasswordAssistanceGUI.php.

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

426  {
427  require_once 'include/inc.pwassist_session_handler.php';
428 
429  // We need to fetch this before form instantiation
430  $pwassist_id = ilUtil::stripSlashes($_POST['key']);
431 
432  $form = $this->getAssignPasswordForm($pwassist_id);
433  if (!$form->checkInput()) {
434  $form->setValuesByPost();
435  $this->showAssistanceForm($form);
436  return;
437  }
438 
439  $username = $form->getInput('username');
440  $password = $form->getInput('password');
441  $pwassist_id = $form->getInput('key');
442 
443  // Retrieve the session
444  $pwassist_session = db_pwassist_session_read($pwassist_id);
445 
446  if (
447  !is_array($pwassist_session) ||
448  count($pwassist_session) == 0 ||
449  $pwassist_session['expires'] < time()
450  ) {
451  ilUtil::sendFailure(str_replace("\\n", '', $this->lng->txt('pwassist_session_expired')));
452  $form->setValuesByPost();
453  $this->showAssistanceForm($form);
454  return;
455  } else {
456  $is_successful = true;
457  $message = '';
458 
459  $userObj = new ilObjUser($pwassist_session['user_id']);
460  if ($userObj == null) {
461  $message = $this->lng->txt('user_does_not_exist');
462  $is_successful = false;
463  }
464 
465  // check if the username entered by the user matches the
466  // one of the user object.
467  if ($is_successful && strcasecmp($userObj->getLogin(), $username) != 0) {
468  $message = $this->lng->txt('pwassist_login_not_match');
469  $is_successful = false;
470  }
471 
472  $error_lng_var = '';
473  if (!ilUtil::isPasswordValidForUserContext($password, $userObj, $error_lng_var)) {
474  $message = $this->lng->txt($error_lng_var);
475  $is_successful = false;
476  }
477 
478  // End of validation
479  // If the validation was successful, we change the password of the
480  // user.
481  // ------------------
482  if ($is_successful) {
483  $is_successful = $userObj->resetPassword($password, $password);
484  if (!$is_successful) {
485  $message = $this->lng->txt('passwd_invalid');
486  }
487  }
488 
489  // If we are successful so far, we update the user object.
490  // ------------------
491  if ($is_successful) {
492  $userObj->update();
493  }
494 
495  // If we are successful, we destroy the password assistance
496  // session and redirect to the login page.
497  // Else we display the form again along with an error message.
498  // ------------------
499  if ($is_successful) {
500  db_pwassist_session_destroy($pwassist_id);
501  $this->showMessageForm(sprintf($this->lng->txt('pwassist_password_assigned'), $username));
502  } else {
503  ilUtil::sendFailure(str_replace("\\n", '', $message));
504  $form->setValuesByPost();
505  $this->showAssignPasswordForm($form, $pwassist_id);
506  }
507  }
508  }
db_pwassist_session_destroy($pwassist_id)
destroy session
db_pwassist_session_read($pwassist_id)
static isPasswordValidForUserContext($clear_text_password, $user, &$error_language_variable=null)
showAssignPasswordForm(ilPropertyFormGUI $form=null, $pwassist_id='')
Assign password form.
$password
Definition: pwgen.php:17
catch(Exception $e) $message
if(isset($_POST['submit'])) $form
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
showMessageForm($text)
This form is used to show a message to the user.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
showAssistanceForm(ilPropertyFormGUI $form=null)
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
$_POST["username"]
+ 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 186 of file class.ilPasswordAssistanceGUI.php.

References $_SERVER, $delimiter, $DIC, $email, $form, GuzzleHttp\Psr7\$protocol, $userid, array, AUTH_LOCAL, AUTH_SAML, db_pwassist_create_id(), db_pwassist_session_find(), db_pwassist_session_write(), getAssistanceForm(), ilObjUser\getEmail(), ilObject\getId(), ilObjUser\getLogin(), ilObjUser\getUserIdByLogin(), https, ilUtil\sendFailure(), showAssistanceForm(), showMessageForm(), and time.

187  {
188  $form = $this->getAssistanceForm();
189  if (!$form->checkInput()) {
190  $form->setValuesByPost();
191  $this->showAssistanceForm($form);
192  return;
193  }
194 
195  $username = $form->getInput('username');
196  $email = $form->getInput('email');
197 
198  $userObj = null;
200  $txt_key = 'pwassist_invalid_username_or_email';
201  if ($userid != 0) {
202  $userObj = new ilObjUser($userid);
203  if (strcasecmp($userObj->getEmail(), $email) != 0) {
204  $userObj = null;
205  } elseif (!strlen($email)) {
206  $userObj = null;
207  $txt_key = 'pwassist_no_email_found';
208  } elseif (
209  (
210  $userObj->getAuthMode(true) != AUTH_LOCAL ||
211  ($userObj->getAuthMode(true) == AUTH_DEFAULT && AUTH_DEFAULT != AUTH_LOCAL)
212  ) && !(
213  $userObj->getAuthMode(true) == AUTH_SAML
214  )
215  ) {
216  $userObj = null;
217  $txt_key = 'pwassist_invalid_auth_mode';
218  }
219  }
220 
221  // No matching user object found?
222  // Show the password assistance form again, and display an error message.
223  if ($userObj == null) {
224  ilUtil::sendFailure(str_replace("\\n", '', $this->lng->txt($txt_key)));
225  $form->setValuesByPost();
226  $this->showAssistanceForm($form);
227  } else {
228  // Matching user object found?
229  // Check if the user is permitted to use the password assistance function,
230  // and then send a password assistance mail to the email address.
231  // FIXME: Extend this if-statement to check whether the user
232  // has the permission to use the password assistance function.
233  // The anonymous user and users who are system administrators are
234  // not allowed to use this feature
235  if (
236  $this->rbacreview->isAssigned($userObj->getId(), ANONYMOUS_ROLE_ID) ||
237  $this->rbacreview->isAssigned($userObj->getId(), SYSTEM_ROLE_ID)
238  ) {
239  ilUtil::sendFailure(str_replace("\\n", '', $this->lng->txt('pwassist_not_permitted')));
240  $form->setValuesByPost();
241  $this->showAssistanceForm($form);
242  } else {
243  $this->sendPasswordAssistanceMail($userObj);
244  $this->showMessageForm(sprintf($this->lng->txt('pwassist_mail_sent'), $email));
245  }
246  }
247  }
static getUserIdByLogin($a_login)
if($orgName !==null) if($spconfig->hasValue('contacts')) $email
Definition: metadata.php:193
if(empty($userids)) $userid
const AUTH_SAML
if(isset($_POST['submit'])) $form
const AUTH_LOCAL
showMessageForm($text)
This form is used to show a message to the user.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
showAssistanceForm(ilPropertyFormGUI $form=null)
+ 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 577 of file class.ilPasswordAssistanceGUI.php.

References $_SERVER, $DIC, $email, $form, GuzzleHttp\Psr7\$protocol, ilObjUser\_getUserIdsByEmail(), array, getUsernameAssistanceForm(), https, ilUtil\sendFailure(), showMessageForm(), and showUsernameAssistanceForm().

578  {
579  require_once 'Services/User/classes/class.ilObjUser.php';
580  require_once 'Services/Utilities/classes/class.ilUtil.php';
581 
582  $form = $this->getUsernameAssistanceForm();
583  if (!$form->checkInput()) {
584  $form->setValuesByPost();
586  return;
587  }
588 
589  // Retrieve form data
590  $email = $form->getInput('email');
591 
592  // Retrieve a user object with matching user name and email address.
594 
595  // No matching user object found?
596  // Show the password assistance form again, and display an error message.
597  if (!is_array($logins) || count($logins) < 1) {
598  ilUtil::sendFailure(str_replace("\\n", '', $this->lng->txt('pwassist_invalid_email')));
599  $form->setValuesByPost();
601  } else {
602  // Matching user object found?
603  // Check if the user is permitted to use the password assistance function,
604  // and then send a password assistance mail to the email address.
605 
606  // FIXME: Extend this if-statement to check whether the user
607  // has the permission to use the password assistance function.
608  // The anonymous user and users who are system administrators are
609  // not allowed to use this feature
610  /* if ($rbacreview->isAssigned($userObj->getID, ANONYMOUS_ROLE_ID)
611  || $rbacreview->isAssigned($userObj->getID, SYSTEM_ROLE_ID)
612  )
613  {
614  $this->showAssistanceForm
615  (
616  $lng->txt("pwassist_not_permitted"),
617  $username,
618  $email
619  );
620  }
621  else */
622  {
623  $this->sendUsernameAssistanceMail($email, $logins);
624  $this->showMessageForm(sprintf($this->lng->txt('pwassist_mail_sent'), $email));
625  }
626  }
627  }
if($orgName !==null) if($spconfig->hasValue('contacts')) $email
Definition: metadata.php:193
if(isset($_POST['submit'])) $form
showMessageForm($text)
This form is used to show a message to the user.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static _getUserIdsByEmail($a_email)
STATIC METHOD get all user_ids of an email address.
showUsernameAssistanceForm(ilPropertyFormGUI $form=null)
Shows the password assistance form.
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilPasswordAssistanceGUI::$ctrl
protected

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

◆ $https

ilPasswordAssistanceGUI::$https
protected

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

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

◆ 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: