52 public function __construct()
80 if(!$this->
settings->get(
'password_assistance'))
83 #if(empty($_SESSION['AccountId']) && $_SESSION['AccountId'] !== false)
85 #$this->ilias->error_obj->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->WARNING);
90 if(!$this->
settings->get(
'setup_ok'))
92 die(
'Setup is not completed. Please run setup routine again.');
102 $this->lng->loadLanguageModule(
'pwassist');
104 $cmd = $this->ctrl->getCmd();
105 $next_class = $this->ctrl->getNextClass($this);
112 return $this->
$cmd();
116 if(!empty(
$_GET[
'key']))
134 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
137 $form->setFormAction($this->ctrl->getFormAction($this,
'submitAssistanceForm'));
138 $form->setTarget(
'_parent');
140 $username =
new ilTextInputGUI($this->lng->txt(
'username'),
'username');
141 $username->setRequired(
true);
142 $form->addItem($username);
145 $email->setRequired(
true);
146 $form->addItem($email);
148 $form->addCommandButton(
'submitAssistanceForm', $this->lng->txt(
'submit'));
158 ilStartUpGUI::initStartUpTemplate(
'tpl.pwassist_assistance.html',
true);
160 $this->tpl->setVariable(
'TXT_PAGEHEADLINE', $this->lng->txt(
'password_assistance'));
162 $this->tpl->setVariable
164 'TXT_ENTER_USERNAME_AND_EMAIL',
170 $this->lng->txt(
'pwassist_enter_username_and_email'),
180 $this->tpl->setVariable(
'FORM', $form->getHTML());
198 if(!$form->checkInput())
200 $form->setValuesByPost();
205 $username = $form->getInput(
'username');
206 $email = $form->getInput(
'email');
210 $txt_key =
'pwassist_invalid_username_or_email';
214 if(strcasecmp($userObj->getEmail(), $email) != 0)
218 elseif(!strlen($email))
221 $txt_key =
'pwassist_no_email_found';
225 ($userObj->getAuthMode(
true) == AUTH_DEFAULT && AUTH_DEFAULT !=
AUTH_LOCAL)
229 $txt_key =
'pwassist_invalid_auth_mode';
238 $form->setValuesByPost();
251 $this->rbacreview->isAssigned($userObj->getId(), ANONYMOUS_ROLE_ID) ||
252 $this->rbacreview->isAssigned($userObj->getId(), SYSTEM_ROLE_ID)
256 $form->setValuesByPost();
282 require_once
'Services/Mail/classes/class.ilMailbox.php';
283 require_once
'Services/Mail/classes/class.ilMail.php';
284 require_once
'Services/Mail/classes/class.ilMimeMail.php';
285 require_once
'include/inc.pwassist_session_handler.php';
290 count($pwassist_session) == 0 ||
291 $pwassist_session[
'expires'] < time() ||
302 $pwassist_session[
'pwassist_id'],
307 $protocol = $this->
https->isDetected() ?
'https://' :
'http://';
309 $server_url = $protocol .
$_SERVER[
'HTTP_HOST'] . substr(
$_SERVER[
'PHP_SELF'], 0, strrpos(
$_SERVER[
'PHP_SELF'],
'/')) .
'/';
314 $pwassist_url = $protocol .
$_SERVER[
'HTTP_HOST']
315 . str_replace(
'ilias.php',
'pwassist.php',
$_SERVER[
'PHP_SELF'])
316 .
'?client_id=' . $this->
ilias->getClientId()
317 . $delimiter .
'lang=' . $this->lng->getLangKey()
318 . $delimiter .
'key=' . $pwassist_session[
'pwassist_id'];
319 $alternative_pwassist_url = $protocol .
$_SERVER[
'HTTP_HOST']
320 . str_replace(
'ilias.php',
'pwassist.php',
$_SERVER[
'PHP_SELF'])
321 .
'?client_id=' . $this->
ilias->getClientId()
322 . $delimiter .
'lang=' . $this->lng->getLangKey()
323 . $delimiter .
'key=' . $pwassist_session[
'pwassist_id'];
325 $contact_address = ilMail::getIliasMailerAddress();
328 $mm->Subject($this->lng->txt(
'pwassist_mail_subject'));
329 $mm->From($contact_address);
339 $this->lng->txt(
'pwassist_mail_body'),
344 'mailto:' .
$DIC[
'ilSetting']->get(
"admin_email"),
345 $alternative_pwassist_url
358 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
361 $form->setFormAction($this->ctrl->getFormAction($this,
'submitAssignPasswordForm'));
362 $form->setTarget(
'_parent');
364 $username =
new ilTextInputGUI($this->lng->txt(
'username'),
'username');
365 $username->setRequired(
true);
366 $form->addItem($username);
369 $password->setRequired(
true);
370 $form->addItem($password);
373 $key->setValue($pwassist_id);
374 $form->addItem($key);
376 $form->addCommandButton(
'submitAssignPasswordForm', $this->lng->txt(
'submit'));
395 require_once
'include/inc.pwassist_session_handler.php';
396 require_once
'Services/Language/classes/class.ilLanguage.php';
401 $pwassist_id =
$_GET[
'key'];
407 count($pwassist_session) == 0 ||
408 $pwassist_session[
'expires'] < time()
416 ilStartUpGUI::initStartUpTemplate(
'tpl.pwassist_assignpassword.html',
true);
418 $this->tpl->setVariable(
'TXT_PAGEHEADLINE', $this->lng->txt(
'password_assistance'));
420 $this->tpl->setVariable(
'TXT_ENTER_USERNAME_AND_NEW_PASSWORD', $this->lng->txt(
'pwassist_enter_username_and_new_password'));
426 $this->tpl->setVariable(
'FORM', $form->getHTML());
450 require_once
'include/inc.pwassist_session_handler.php';
456 if(!$form->checkInput())
458 $form->setValuesByPost();
463 $username = $form->getInput(
'username');
464 $password = $form->getInput(
'password');
465 $pwassist_id = $form->getInput(
'key');
471 count($pwassist_session) == 0 ||
472 $pwassist_session[
'expires'] < time()
476 $form->setValuesByPost();
482 $is_successful =
true;
485 $userObj =
new ilObjUser($pwassist_session[
'user_id']);
488 $message = $this->lng->txt(
'user_does_not_exist');
489 $is_successful =
false;
494 if($is_successful && strcasecmp($userObj->getLogin(), $username) != 0)
496 $message = $this->lng->txt(
'pwassist_login_not_match');
497 $is_successful =
false;
503 $message = $this->lng->txt($error_lng_var);
504 $is_successful =
false;
513 $is_successful = $userObj->resetPassword($password, $password);
516 $message = $this->lng->txt(
'passwd_invalid');
539 $form->setValuesByPost();
550 require_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
553 $form->setFormAction($this->ctrl->getFormAction($this,
'submitUsernameAssistanceForm'));
554 $form->setTarget(
'_parent');
557 $email->setRequired(
true);
558 $form->addItem($email);
560 $form->addCommandButton(
'submitUsernameAssistanceForm', $this->lng->txt(
'submit'));
577 ilStartUpGUI::initStartUpTemplate(
'tpl.pwassist_username_assistance.html',
true);
579 $this->tpl->setVariable(
'TXT_PAGEHEADLINE', $this->lng->txt(
'password_assistance'));
581 $this->tpl->setVariable
583 'TXT_ENTER_USERNAME_AND_EMAIL',
589 $this->lng->txt(
'pwassist_enter_email'),
599 $this->tpl->setVariable(
'FORM', $form->getHTML());
616 require_once
'Services/User/classes/class.ilObjUser.php';
617 require_once
'Services/Utilities/classes/class.ilUtil.php';
620 if(!$form->checkInput())
622 $form->setValuesByPost();
628 $email = $form->getInput(
'email');
635 if(!is_array($logins) || count($logins) < 1)
638 $form->setValuesByPost();
686 require_once
'Services/Mail/classes/class.ilMailbox.php';
687 require_once
'Services/Mail/classes/class.ilMail.php';
688 require_once
'Services/Mail/classes/class.ilMimeMail.php';
689 require_once
'include/inc.pwassist_session_handler.php';
691 $protocol = $this->
https->isDetected() ?
'https://' :
'http://';
693 $server_url = $protocol .
$_SERVER[
'HTTP_HOST'] . substr(
$_SERVER[
'PHP_SELF'], 0, strrpos(
$_SERVER[
'PHP_SELF'],
'/')) .
'/';
694 $login_url = $server_url .
'pwassist.php' .
'?client_id=' . $this->
ilias->getClientId() .
'&lang=' . $this->lng->getLangKey();
695 $contact_address = ilMail::getIliasMailerAddress();
698 $mm->Subject($this->lng->txt(
'pwassist_mail_subject'));
699 $mm->From($contact_address);
709 $this->lng->txt(
'pwassist_username_mail_body'),
710 join($logins,
",\n"),
714 'mailto:' .
$DIC[
'ilSetting']->
get(
"admin_email"),
728 ilStartUpGUI::initStartUpTemplate(
'tpl.pwassist_message.html',
true);
729 $this->tpl->setVariable(
'TXT_PAGEHEADLINE', $this->lng->txt(
'password_assistance'));
732 $this->tpl->setVariable(
'TXT_TEXT', str_replace(
"\\n",
'<br />',
$text));
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
this class encapsulates the PHP mail() function.
static getUserIdByLogin($a_login)
getEmail()
get email address @access public
getLogin()
get login / username @access public
static _getUserIdsByEmail($a_email)
STATIC METHOD get all user_ids of an email address.
getId()
get object id @access public
Password assistance facility for users who have forgotten their password or for users for whom no pas...
showAssistanceForm(ilPropertyFormGUI $form=null)
sendUsernameAssistanceMail($email, array $logins)
Creates (or reuses) a password assistance session, and sends a password assistance mail to the specif...
submitUsernameAssistanceForm()
Reads the submitted data from the password assistance form.
showUsernameAssistanceForm(ilPropertyFormGUI $form=null)
Shows the password assistance form.
submitAssistanceForm()
Reads the submitted data from the password assistance form.
getAssignPasswordForm($pwassist_id)
getUsernameAssistanceForm()
sendPasswordAssistanceMail(ilObjUser $userObj)
Creates (or reuses) a password assistance session, and sends a password assistance mail to the specif...
showAssignPasswordForm(ilPropertyFormGUI $form=null, $pwassist_id='')
Assign password form.
submitAssignPasswordForm()
Reads the submitted data from the password assistance form.
showMessageForm($text)
This form is used to show a message to the user.
This class represents a text property in a property form.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
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)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
db_pwassist_session_destroy($pwassist_id)
destroy session
db_pwassist_session_find($user_id)
db_pwassist_session_write($pwassist_id, $maxlifetime, $user_id)
Writes serialized session data to the database.
db_pwassist_session_read($pwassist_id)
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
redirection script todo: (a better solution should control the processing via a xml file)
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']