55    public function __construct()
 
   83        if (!$this->
settings->get(
'password_assistance')) { 
 
   85            #if(empty($_SESSION['AccountId']) && $_SESSION['AccountId'] !== false) 
   87                #$this->ilias->error_obj->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->WARNING); 
   92        if (!$this->
settings->get(
'setup_ok')) {
 
   93            die(
'Setup is not completed. Please run setup routine again.');
 
   99        if (
$lang != 
null && 
$lang != 
'' && $this->lng->getLangKey() != 
$lang) {
 
  102        $this->lng->loadLanguageModule(
'pwassist');
 
  104        $cmd        = $this->ctrl->getCmd();
 
  105        $next_class = $this->ctrl->getNextClass($this);
 
  107        switch ($next_class) {
 
  110                    return $this->$cmd();
 
  112                    if (!empty(
$_GET[
'key'])) {
 
  127        require_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
  130        $form->setFormAction($this->ctrl->getFormAction($this, 
'submitAssistanceForm'));
 
  131        $form->setTarget(
'_parent');
 
  133        $username = 
new ilTextInputGUI($this->lng->txt(
'username'), 
'username');
 
  134        $username->setRequired(
true);
 
  135        $form->addItem($username);
 
  138        $email->setRequired(
true);
 
  141        $form->addCommandButton(
'submitAssistanceForm', $this->lng->txt(
'submit'));
 
  151        ilStartUpGUI::initStartUpTemplate(
'tpl.pwassist_assistance.html', 
true);
 
  153        $this->tpl->setVariable(
'TXT_PAGEHEADLINE', $this->lng->txt(
'password_assistance'));
 
  155        $this->tpl->setVariable(
 
  156            'TXT_ENTER_USERNAME_AND_EMAIL',
 
  161                    $this->lng->txt(
'pwassist_enter_username_and_email'),
 
  170        $this->tpl->setVariable(
'FORM', 
$form->getHTML());
 
  189        if (!
$form->checkInput()) {
 
  190            $form->setValuesByPost();
 
  195        $username = 
$form->getInput(
'username');
 
  200        $txt_key = 
'pwassist_invalid_username_or_email';
 
  203            if (strcasecmp($userObj->getEmail(), 
$email) != 0) {
 
  205            } elseif (!strlen(
$email)) {
 
  207                $txt_key = 
'pwassist_no_email_found';
 
  211                    ($userObj->getAuthMode(
true) == AUTH_DEFAULT && AUTH_DEFAULT != 
AUTH_LOCAL)
 
  217                $txt_key = 
'pwassist_invalid_auth_mode';
 
  223        if ($userObj == 
null) {
 
  225            $form->setValuesByPost();
 
  236                $this->rbacreview->isAssigned($userObj->getId(), ANONYMOUS_ROLE_ID) ||
 
  237                $this->rbacreview->isAssigned($userObj->getId(), SYSTEM_ROLE_ID)
 
  240                $form->setValuesByPost();
 
  243                $this->sendPasswordAssistanceMail($userObj);
 
  260    public function sendPasswordAssistanceMail(
ilObjUser $userObj)
 
  264        require_once 
'Services/Mail/classes/class.ilMailbox.php';
 
  265        require_once 
'Services/Mail/classes/class.ilMail.php';
 
  266        require_once 
'Services/Mail/classes/class.ilMimeMail.php';
 
  267        require_once 
'include/inc.pwassist_session_handler.php';
 
  272            !is_array($pwassist_session) ||
 
  273            count($pwassist_session) == 0 ||
 
  274            $pwassist_session[
'expires'] < time() ||
 
  284                $pwassist_session[
'pwassist_id'],
 
  297            . str_replace(
'ilias.php', 
'pwassist.php', 
$_SERVER[
'PHP_SELF'])
 
  298            . 
'?client_id=' . $this->
ilias->getClientId()
 
  299            . 
$delimiter . 
'lang=' . $this->lng->getLangKey()
 
  300            . 
$delimiter . 
'key=' . $pwassist_session[
'pwassist_id'];
 
  302            . str_replace(
'ilias.php', 
'pwassist.php', 
$_SERVER[
'PHP_SELF'])
 
  303            . 
'?client_id=' . $this->
ilias->getClientId()
 
  304            . 
$delimiter . 
'lang=' . $this->lng->getLangKey()
 
  305            . 
$delimiter . 
'key=' . $pwassist_session[
'pwassist_id'];
 
  308        $senderFactory = 
$DIC[
"mail.mime.sender.factory"];
 
  309        $sender        = $senderFactory->system();
 
  312        $mm->Subject($this->lng->txt(
'pwassist_mail_subject'));
 
  320                    $this->lng->txt(
'pwassist_mail_body'),
 
  325                    'mailto:' . 
$DIC->settings()->get(
"admin_email"),
 
  326                    $alternative_pwassist_url
 
  339        require_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
  342        $form->setFormAction($this->ctrl->getFormAction($this, 
'submitAssignPasswordForm'));
 
  343        $form->setTarget(
'_parent');
 
  345        $username = 
new ilTextInputGUI($this->lng->txt(
'username'), 
'username');
 
  346        $username->setRequired(
true);
 
  347        $form->addItem($username);
 
  354        $key->setValue($pwassist_id);
 
  357        $form->addCommandButton(
'submitAssignPasswordForm', $this->lng->txt(
'submit'));
 
  376        require_once 
'include/inc.pwassist_session_handler.php';
 
  377        require_once 
'Services/Language/classes/class.ilLanguage.php';
 
  381            $pwassist_id = 
$_GET[
'key'];
 
  387            !is_array($pwassist_session) ||
 
  388            count($pwassist_session) == 0 ||
 
  389            $pwassist_session[
'expires'] < time()
 
  394            ilStartUpGUI::initStartUpTemplate(
'tpl.pwassist_assignpassword.html', 
true);
 
  396            $this->tpl->setVariable(
'TXT_PAGEHEADLINE', $this->lng->txt(
'password_assistance'));
 
  398            $this->tpl->setVariable(
'TXT_ENTER_USERNAME_AND_NEW_PASSWORD', $this->lng->txt(
'pwassist_enter_username_and_new_password'));
 
  403            $this->tpl->setVariable(
'FORM', 
$form->getHTML());
 
  427        require_once 
'include/inc.pwassist_session_handler.php';
 
  433        if (!
$form->checkInput()) {
 
  434            $form->setValuesByPost();
 
  439        $username    = 
$form->getInput(
'username');
 
  441        $pwassist_id = 
$form->getInput(
'key');
 
  447            !is_array($pwassist_session) ||
 
  448            count($pwassist_session) == 0 ||
 
  449            $pwassist_session[
'expires'] < time()
 
  452            $form->setValuesByPost();
 
  456            $is_successful = 
true;
 
  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;
 
  467            if ($is_successful && strcasecmp($userObj->
getLogin(), $username) != 0) {
 
  468                $message       = $this->lng->txt(
'pwassist_login_not_match');
 
  469                $is_successful = 
false;
 
  474                $message       = $this->lng->txt($error_lng_var);
 
  475                $is_successful = 
false;
 
  482            if ($is_successful) {
 
  484                if (!$is_successful) {
 
  485                    $message = $this->lng->txt(
'passwd_invalid');
 
  491            if ($is_successful) {
 
  499            if ($is_successful) {
 
  504                $form->setValuesByPost();
 
  515        require_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
  518        $form->setFormAction($this->ctrl->getFormAction($this, 
'submitUsernameAssistanceForm'));
 
  519        $form->setTarget(
'_parent');
 
  522        $email->setRequired(
true);
 
  525        $form->addCommandButton(
'submitUsernameAssistanceForm', $this->lng->txt(
'submit'));
 
  542        ilStartUpGUI::initStartUpTemplate(
'tpl.pwassist_username_assistance.html', 
true);
 
  544        $this->tpl->setVariable(
'TXT_PAGEHEADLINE', $this->lng->txt(
'password_assistance'));
 
  546        $this->tpl->setVariable(
 
  547            'TXT_ENTER_USERNAME_AND_EMAIL',
 
  552                    $this->lng->txt(
'pwassist_enter_email'),
 
  561        $this->tpl->setVariable(
'FORM', 
$form->getHTML());
 
  579        require_once 
'Services/User/classes/class.ilObjUser.php';
 
  580        require_once 
'Services/Utilities/classes/class.ilUtil.php';
 
  583        if (!
$form->checkInput()) {
 
  584            $form->setValuesByPost();
 
  597        if (!is_array($logins) || count($logins) < 1) {
 
  599            $form->setValuesByPost();
 
  623                $this->sendUsernameAssistanceMail(
$email, $logins);
 
  641    public function sendUsernameAssistanceMail(
$email, array $logins)
 
  645        require_once 
'Services/Mail/classes/class.ilMailbox.php';
 
  646        require_once 
'Services/Mail/classes/class.ilMail.php';
 
  647        require_once 
'Services/Mail/classes/class.ilMimeMail.php';
 
  648        require_once 
'include/inc.pwassist_session_handler.php';
 
  653        $login_url       = $server_url . 
'pwassist.php' . 
'?client_id=' . $this->
ilias->getClientId() . 
'&lang=' . $this->lng->getLangKey();
 
  656        $senderFactory = 
$DIC[
"mail.mime.sender.factory"];
 
  657        $sender        = $senderFactory->system();
 
  660        $mm->Subject($this->lng->txt(
'pwassist_mail_subject'));
 
  668                    $this->lng->txt(
'pwassist_username_mail_body'),
 
  669                    join($logins, 
",\n"),
 
  673                    'mailto:' . 
$DIC->settings()->get(
"admin_email"),
 
  687        ilStartUpGUI::initStartUpTemplate(
'tpl.pwassist_message.html', 
true);
 
  688        $this->tpl->setVariable(
'TXT_PAGEHEADLINE', $this->lng->txt(
'password_assistance'));
 
  691        $this->tpl->setVariable(
'TXT_TEXT', str_replace(
"\\n", 
'<br />', 
$text));
 
  701        $this->tpl->setPermanentLink(
'usr', 
null, $context);
 
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
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.
update()
update object in db
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)
const PERMANENT_LINK_TARGET_PW
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.
fillPermanentLink($context)
getAssignPasswordForm($pwassist_id)
getUsernameAssistanceForm()
showAssignPasswordForm(ilPropertyFormGUI $form=null, $pwassist_id='')
Assign password form.
submitAssignPasswordForm()
Reads the submitted data from the password assistance form.
const PERMANENT_LINK_TARGET_NAME
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
if(empty($userids)) $userid
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)
catch(Exception $e) $message
redirection script todo: (a better solution should control the processing via a xml file)
if(isset($_POST['submit'])) $form
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']