52 public function __construct()
80 if(!$this->settings->get(
'password_assistance'))
84 $this->
ilias->error_obj->raiseError($this->lng->txt(
'permission_denied'), $this->
ilias->error_obj->WARNING);
89 if(!$this->settings->get(
'setup_ok'))
91 die(
'Setup is not completed. Please run setup routine again.');
101 $this->lng->loadLanguageModule(
'pwassist');
103 $cmd = $this->ctrl->getCmd();
104 $next_class = $this->ctrl->getNextClass($this);
111 return $this->
$cmd();
115 if(!empty(
$_GET[
'key']))
133 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
136 $form->setFormAction($this->ctrl->getFormAction($this,
'submitAssistanceForm'));
137 $form->setTarget(
'_parent');
139 $username =
new ilTextInputGUI($this->lng->txt(
'username'),
'username');
141 $form->addItem($username);
145 $form->addItem($email);
147 $form->addCommandButton(
'submitAssistanceForm', $this->lng->txt(
'submit'));
157 ilStartUpGUI::initStartUpTemplate(
'tpl.pwassist_assistance.html',
true);
159 $this->tpl->setVariable(
'TXT_PAGEHEADLINE', $this->lng->txt(
'password_assistance'));
161 $this->tpl->setVariable
163 'TXT_ENTER_USERNAME_AND_EMAIL',
169 $this->lng->txt(
'pwassist_enter_username_and_email'),
179 $this->tpl->setVariable(
'FORM', $form->getHTML());
197 if(!$form->checkInput())
199 $form->setValuesByPost();
204 $username = $form->getInput(
'username');
205 $email = $form->getInput(
'email');
209 $txt_key =
'pwassist_invalid_username_or_email';
213 if(strcasecmp($userObj->getEmail(), $email) != 0)
217 elseif(!strlen($email))
220 $txt_key =
'pwassist_no_email_found';
224 ($userObj->getAuthMode(
true) == AUTH_DEFAULT && AUTH_DEFAULT !=
AUTH_LOCAL)
228 $txt_key =
'pwassist_invalid_auth_mode';
237 $form->setValuesByPost();
250 $this->rbacreview->isAssigned($userObj->getId(), ANONYMOUS_ROLE_ID) ||
251 $this->rbacreview->isAssigned($userObj->getId(), SYSTEM_ROLE_ID)
255 $form->setValuesByPost();
261 $this->
showMessageForm(sprintf($this->lng->txt(
'pwassist_mail_sent'), $email));
279 require_once
'Services/Mail/classes/class.ilMailbox.php';
280 require_once
'Services/Mail/classes/class.ilMail.php';
281 require_once
'Services/Mail/classes/class.ilMimeMail.php';
282 require_once
'include/inc.pwassist_session_handler.php';
287 count($pwassist_session) == 0 ||
288 $pwassist_session[
'expires'] < time() ||
299 $pwassist_session[
'pwassist_id'],
304 $protocol = $this->https->isDetected() ?
'https://' :
'http://';
306 $server_url = $protocol .
$_SERVER[
'HTTP_HOST'] . substr(
$_SERVER[
'PHP_SELF'], 0, strrpos(
$_SERVER[
'PHP_SELF'],
'/')) .
'/';
311 $pwassist_url = $protocol .
$_SERVER[
'HTTP_HOST']
312 . str_replace(
'ilias.php',
'pwassist.php',
$_SERVER[
'PHP_SELF'])
313 .
'?client_id=' . $this->
ilias->getClientId()
314 . $delimiter .
'lang=' . $this->lng->getLangKey()
315 . $delimiter .
'key=' . $pwassist_session[
'pwassist_id'];
316 $alternative_pwassist_url = $protocol .
$_SERVER[
'HTTP_HOST']
317 . str_replace(
'ilias.php',
'pwassist.php',
$_SERVER[
'PHP_SELF'])
318 .
'?client_id=' . $this->
ilias->getClientId()
319 . $delimiter .
'lang=' . $this->lng->getLangKey()
320 . $delimiter .
'key=' . $pwassist_session[
'pwassist_id'];
325 $mm->Subject($this->lng->txt(
'pwassist_mail_subject'));
326 $mm->From($contact_address);
336 $this->lng->txt(
'pwassist_mail_body'),
341 'mailto:' . $contact_address[0],
342 $alternative_pwassist_url
355 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
358 $form->setFormAction($this->ctrl->getFormAction($this,
'submitAssignPasswordForm'));
359 $form->setTarget(
'_parent');
361 $username =
new ilTextInputGUI($this->lng->txt(
'username'),
'username');
363 $form->addItem($username);
367 $form->addItem($password);
370 $key->setValue($pwassist_id);
371 $form->addItem($key);
373 $form->addCommandButton(
'submitAssignPasswordForm', $this->lng->txt(
'submit'));
392 require_once
'include/inc.pwassist_session_handler.php';
393 require_once
'Services/Language/classes/class.ilLanguage.php';
398 $pwassist_id =
$_GET[
'key'];
404 count($pwassist_session) == 0 ||
405 $pwassist_session[
'expires'] < time()
413 ilStartUpGUI::initStartUpTemplate(
'tpl.pwassist_assignpassword.html',
true);
415 $this->tpl->setVariable(
'TXT_PAGEHEADLINE', $this->lng->txt(
'password_assistance'));
417 $this->tpl->setVariable(
'TXT_ENTER_USERNAME_AND_NEW_PASSWORD', $this->lng->txt(
'pwassist_enter_username_and_new_password'));
423 $this->tpl->setVariable(
'FORM', $form->getHTML());
447 require_once
'include/inc.pwassist_session_handler.php';
453 if(!$form->checkInput())
455 $form->setValuesByPost();
460 $username = $form->getInput(
'username');
461 $password = $form->getInput(
'password');
462 $pwassist_id = $form->getInput(
'key');
468 count($pwassist_session) == 0 ||
469 $pwassist_session[
'expires'] < time()
473 $form->setValuesByPost();
479 $is_successful =
true;
482 $userObj =
new ilObjUser($pwassist_session[
'user_id']);
485 $message = $this->lng->txt(
'user_does_not_exist');
486 $is_successful =
false;
491 if($is_successful && strcasecmp($userObj->getLogin(), $username) != 0)
493 $message = $this->lng->txt(
'pwassist_login_not_match');
494 $is_successful =
false;
500 $message = $this->lng->txt($error_lng_var);
501 $is_successful =
false;
510 $is_successful = $userObj->resetPassword($password, $password);
513 $message = $this->lng->txt(
'passwd_invalid');
531 $this->
showMessageForm(sprintf($this->lng->txt(
'pwassist_password_assigned'), $username));
536 $form->setValuesByPost();
547 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
550 $form->setFormAction($this->ctrl->getFormAction($this,
'submitUsernameAssistanceForm'));
551 $form->setTarget(
'_parent');
555 $form->addItem($email);
557 $form->addCommandButton(
'submitUsernameAssistanceForm', $this->lng->txt(
'submit'));
574 ilStartUpGUI::initStartUpTemplate(
'tpl.pwassist_username_assistance.html',
true);
576 $this->tpl->setVariable(
'TXT_PAGEHEADLINE', $this->lng->txt(
'password_assistance'));
578 $this->tpl->setVariable
580 'TXT_ENTER_USERNAME_AND_EMAIL',
586 $this->lng->txt(
'pwassist_enter_email'),
596 $this->tpl->setVariable(
'FORM', $form->getHTML());
613 require_once
'Services/User/classes/class.ilObjUser.php';
614 require_once
'Services/Utilities/classes/class.ilUtil.php';
617 if(!$form->checkInput())
619 $form->setValuesByPost();
625 $email = $form->getInput(
'email');
632 if(!is_array($logins) || count($logins) < 1)
635 $form->setValuesByPost();
662 $this->
showMessageForm(sprintf($this->lng->txt(
'pwassist_mail_sent'), $email));
681 require_once
'Services/Mail/classes/class.ilMailbox.php';
682 require_once
'Services/Mail/classes/class.ilMail.php';
683 require_once
'Services/Mail/classes/class.ilMimeMail.php';
684 require_once
'include/inc.pwassist_session_handler.php';
686 $protocol = $this->https->isDetected() ?
'https://' :
'http://';
688 $server_url = $protocol .
$_SERVER[
'HTTP_HOST'] . substr(
$_SERVER[
'PHP_SELF'], 0, strrpos(
$_SERVER[
'PHP_SELF'],
'/')) .
'/';
689 $login_url = $server_url .
'pwassist.php' .
'?client_id=' . $this->
ilias->getClientId() .
'&lang=' . $this->lng->getLangKey();
693 $mm->Subject($this->lng->txt(
'pwassist_mail_subject'));
694 $mm->From($contact_address);
704 $this->lng->txt(
'pwassist_username_mail_body'),
705 join($logins,
",\n"),
709 'mailto:' . $contact_address[0],
723 ilStartUpGUI::initStartUpTemplate(
'tpl.pwassist_message.html',
true);
724 $this->tpl->setVariable(
'TXT_PAGEHEADLINE', $this->lng->txt(
'password_assistance'));
727 $this->tpl->setVariable(
'TXT_TEXT', str_replace(
"\\n",
'<br />',
$text));
getAssignPasswordForm($pwassist_id)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
getLogin()
get login / username public
db_pwassist_session_destroy($pwassist_id)
destroy session
sendPasswordAssistanceMail(ilObjUser $userObj)
Creates (or reuses) a password assistance session, and sends a password assistance mail to the specif...
db_pwassist_session_read($pwassist_id)
static isPasswordValidForUserContext($clear_text_password, $user, &$error_language_variable=null)
getUserIdByLogin($a_login)
showAssignPasswordForm(ilPropertyFormGUI $form=null, $pwassist_id='')
Assign password form.
getEmail()
get email address public
db_pwassist_session_find($user_id)
this class encapsulates the PHP mail() function.
getId()
get object id public
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
submitUsernameAssistanceForm()
Reads the submitted data from the password assistance form.
This class represents a text property in a property form.
redirection script todo: (a better solution should control the processing via a xml file) ...
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.
Password assistance facility for users who have forgotten their password or for users for whom no pas...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
getUsernameAssistanceForm()
showAssistanceForm(ilPropertyFormGUI $form=null)
submitAssignPasswordForm()
Reads the submitted data from the password assistance form.
submitAssistanceForm()
Reads the submitted data from the password assistance form.
sendUsernameAssistanceMail($email, array $logins)
Creates (or reuses) a password assistance session, and sends a password assistance mail to the specif...
db_pwassist_session_write($pwassist_id, $maxlifetime, $user_id)
Writes serialized session data to the database.
showUsernameAssistanceForm(ilPropertyFormGUI $form=null)
Shows the password assistance form.
_getUserIdsByEmail($a_email)
STATIC METHOD get all user_ids of an email address.
static getIliasMailerAddress()
Builds an email address used for system notifications.