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');
 
  140                $username->setRequired(
true);
 
  141                $form->addItem($username);
 
  144                $email->setRequired(
true);
 
  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'),
 
  339                                        $_SERVER[
'REMOTE_ADDR'],
 
  341                                        'mailto:' . $contact_address,
 
  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');
 
  362                $username->setRequired(
true);
 
  363                $form->addItem($username);
 
  366                $password->setRequired(
true);
 
  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()
 
  412                        ilStartUpGUI::initStartUpTemplate(
'tpl.pwassist_assignpassword.html', 
true);
 
  414                        $this->tpl->setVariable(
'TXT_PAGEHEADLINE', $this->lng->txt(
'password_assistance'));
 
  416                        $this->tpl->setVariable(
'TXT_ENTER_USERNAME_AND_NEW_PASSWORD', $this->lng->txt(
'pwassist_enter_username_and_new_password'));
 
  422                        $this->tpl->setVariable(
'FORM', $form->getHTML());
 
  446                require_once 
'include/inc.pwassist_session_handler.php';
 
  452                if(!$form->checkInput())
 
  454                        $form->setValuesByPost();
 
  459                $username    = $form->getInput(
'username');
 
  460                $password    = $form->getInput(
'password');
 
  461                $pwassist_id = $form->getInput(
'key');
 
  467                        count($pwassist_session) == 0 ||
 
  468                        $pwassist_session[
'expires'] < time()
 
  472                        $form->setValuesByPost();
 
  478                        $is_successful = 
true;
 
  481                        $userObj = 
new ilObjUser($pwassist_session[
'user_id']);
 
  484                                $message       = $this->lng->txt(
'user_does_not_exist');
 
  485                                $is_successful = 
false;
 
  490                        if($is_successful && strcasecmp($userObj->getLogin(), $username) != 0)
 
  492                                $message       = $this->lng->txt(
'pwassist_login_not_match');
 
  493                                $is_successful = 
false;
 
  499                                $message       = $this->lng->txt($error_lng_var);
 
  500                                $is_successful = 
false;
 
  509                                $is_successful = $userObj->resetPassword($password, $password);
 
  512                                        $message = $this->lng->txt(
'passwd_invalid');
 
  530                                $this->
showMessageForm(sprintf($this->lng->txt(
'pwassist_password_assigned'), $username));
 
  535                                $form->setValuesByPost();
 
  546                require_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
  549                $form->setFormAction($this->ctrl->getFormAction($this, 
'submitUsernameAssistanceForm'));
 
  550                $form->setTarget(
'_parent');
 
  553                $email->setRequired(
true);
 
  554                $form->addItem($email);
 
  556                $form->addCommandButton(
'submitUsernameAssistanceForm', $this->lng->txt(
'submit'));
 
  573                ilStartUpGUI::initStartUpTemplate(
'tpl.pwassist_username_assistance.html', 
true);
 
  575                $this->tpl->setVariable(
'TXT_PAGEHEADLINE', $this->lng->txt(
'password_assistance'));
 
  577                $this->tpl->setVariable
 
  579                        'TXT_ENTER_USERNAME_AND_EMAIL',
 
  585                                        $this->lng->txt(
'pwassist_enter_email'),
 
  595                $this->tpl->setVariable(
'FORM', $form->getHTML());
 
  612                require_once 
'Services/User/classes/class.ilObjUser.php';
 
  613                require_once 
'Services/Utilities/classes/class.ilUtil.php';
 
  616                if(!$form->checkInput())
 
  618                        $form->setValuesByPost();
 
  624                $email = $form->getInput(
'email');
 
  631                if(!is_array($logins) || count($logins) < 1)
 
  634                        $form->setValuesByPost();
 
  661                                $this->
showMessageForm(sprintf($this->lng->txt(
'pwassist_mail_sent'), $email));
 
  680                require_once 
'Services/Mail/classes/class.ilMailbox.php';
 
  681                require_once 
'Services/Mail/classes/class.ilMail.php';
 
  682                require_once 
'Services/Mail/classes/class.ilMimeMail.php';
 
  683                require_once 
'include/inc.pwassist_session_handler.php';
 
  685                $protocol = $this->https->isDetected() ? 
'https://' : 
'http://';
 
  687                $server_url      = $protocol . $_SERVER[
'HTTP_HOST'] . substr($_SERVER[
'PHP_SELF'], 0, strrpos($_SERVER[
'PHP_SELF'], 
'/')) . 
'/';
 
  688                $login_url       = $server_url . 
'pwassist.php' . 
'?client_id=' . $this->
ilias->getClientId() . 
'&lang=' . $this->lng->getLangKey();
 
  692                $mm->Subject($this->lng->txt(
'pwassist_mail_subject'));
 
  693                $mm->From($contact_address);
 
  703                                        $this->lng->txt(
'pwassist_username_mail_body'),
 
  704                                        join($logins, 
",\n"),
 
  706                                        $_SERVER[
'REMOTE_ADDR'],
 
  708                                        'mailto:' . $contact_address,
 
  722                ilStartUpGUI::initStartUpTemplate(
'tpl.pwassist_message.html', 
true);
 
  723                $this->tpl->setVariable(
'TXT_PAGEHEADLINE', $this->lng->txt(
'password_assistance'));
 
  726                $this->tpl->setVariable(
'TXT_TEXT', str_replace(
"\\n", 
'<br />', $text));
 
static getIliasMailerAddress()
Builds an email address used for system notifications.
this class encapsulates the PHP mail() function.
getEmail()
get email address @access public
getUserIdByLogin($a_login)
_getUserIdsByEmail($a_email)
STATIC METHOD get all user_ids of an email address.
getLogin()
get login / username @access public
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)
redirection script todo: (a better solution should control the processing via a xml file)