53 if (!$ilSetting->get(
"password_assistance"))
57 $ilErr->raiseError($lng->txt(
"permission_denied"),$ilias->error_obj->WARNING);
62 if (!$ilSetting->get(
"setup_ok"))
64 die(
"Setup is not completed. Please run setup routine again. (pwassist.php)");
74 $lng->loadLanguageModule(
'pwassist');
76 $cmd = $this->ctrl->getCmd();
77 $next_class = $this->ctrl->getNextClass($this);
88 if (!empty(
$_GET[
"key"])) {
123 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.pwassist_assistance.html");
127 $tpl->setCurrentBlock(
"pw_message");
128 $tpl->setVariable(
"TXT_MESSAGE", str_replace(
"\\n",
"<br>",$message));
129 $tpl->parseCurrentBlock();
132 $tpl->setVariable(
"FORMACTION",
133 $this->ctrl->getFormAction($this));
134 $tpl->setVariable(
"TARGET",
"target=\"_parent\"");
135 $tpl->setVariable(
"IMG_AUTH",
137 $tpl->setVariable(
"TXT_PAGEHEADLINE", $lng->txt(
"password_assistance"));
139 $contact_address = $ilias->getSetting(
"admin_email");
142 "TXT_ENTER_USERNAME_AND_EMAIL",
148 $lng->txt(
"pwassist_enter_username_and_email"),
149 "<a href=\"mailto:".$contact_address.
"\">".$contact_address.
"</a>"
153 $tpl->setVariable(
"TXT_USERNAME", $lng->txt(
"username"));
154 $tpl->setVariable(
"TXT_EMAIL", $lng->txt(
"email"));
155 $tpl->setVariable(
"USERNAME", htmlentities($username));
156 $tpl->setVariable(
"EMAIL", htmlentities($email));
157 $tpl->setVariable(
"TXT_SUBMIT", $lng->txt(
"submit"));
158 $tpl->setVariable(
"BACK", $lng->txt(
"back"));
159 $tpl->setVariable(
"LINK_BACK",
160 $this->ctrl->getLinkTargetByClass(
"ilstartupgui",
"showLogin"));
161 $tpl->setVariable(
"LANG", $lng->getLangKey());
186 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.pwassist_username_assistance.html");
190 $tpl->setCurrentBlock(
"pw_message");
191 $tpl->setVariable(
"TXT_MESSAGE", str_replace(
"\\n",
"<br>",$message));
192 $tpl->parseCurrentBlock();
195 $tpl->setVariable(
"FORMACTION",
196 $this->ctrl->getFormAction($this));
197 $tpl->setVariable(
"IMG_AUTH",
199 $tpl->setVariable(
"TARGET",
"target=\"_parent\"");
200 $tpl->setVariable(
"TXT_PAGEHEADLINE", $lng->txt(
"password_assistance"));
202 $contact_address = $ilias->getSetting(
"admin_email");
205 "TXT_ENTER_USERNAME_AND_EMAIL",
211 $lng->txt(
"pwassist_enter_email"),
212 "<a href=\"mailto:".$contact_address.
"\">".$contact_address.
"</a>"
216 $tpl->setVariable(
"TXT_USERNAME", $lng->txt(
"username"));
217 $tpl->setVariable(
"TXT_EMAIL", $lng->txt(
"email"));
218 $tpl->setVariable(
"USERNAME", $username);
219 $tpl->setVariable(
"EMAIL", htmlentities($email));
220 $tpl->setVariable(
"TXT_SUBMIT", $lng->txt(
"submit"));
221 $tpl->setVariable(
"BACK", $lng->txt(
"back"));
222 $tpl->setVariable(
"LINK_BACK",
223 $this->ctrl->getLinkTargetByClass(
"ilstartupgui",
"showLogin"));
224 $tpl->setVariable(
"LANG", $lng->getLangKey());
243 global
$tpl, $ilias,
$lng, $rbacadmin, $rbacreview;
245 require_once
'./Services/User/classes/class.ilObjUser.php';
246 require_once
"./Services/Utilities/classes/class.ilUtil.php";
255 $txt_key =
"pwassist_invalid_username_or_email";
259 if (strcasecmp($userObj->getEmail(), $email) != 0)
263 elseif(!strlen($email))
266 $txt_key =
'pwassist_no_email_found';
268 else if ($userObj->getAuthMode(
true) !=
AUTH_LOCAL ||
269 ($userObj->getAuthMode(
true) == AUTH_DEFAULT && AUTH_DEFAULT !=
AUTH_LOCAL))
272 $txt_key =
"pwassist_invalid_auth_mode";
278 if ($userObj == null)
297 if ($rbacreview->isAssigned($userObj->getID, ANONYMOUS_ROLE_ID)
298 || $rbacreview->isAssigned($userObj->getID, SYSTEM_ROLE_ID)
303 $lng->txt(
"pwassist_not_permitted"),
316 $lng->txt(
"pwassist_mail_sent"),
338 global
$tpl, $ilias,
$lng, $rbacadmin, $rbacreview;
340 require_once
'./Services/User/classes/class.ilObjUser.php';
341 require_once
"./Services/Utilities/classes/class.ilUtil.php";
351 if (count($logins)< 1)
355 $lng->txt(
"pwassist_invalid_email"),
360 elseif(!strlen($email))
364 $lng->txt(
"pwassist_invalid_email"),
398 $lng->txt(
"pwassist_mail_sent"),
423 include_once
"Services/Mail/classes/class.ilMailbox.php";
424 include_once
"Services/Mail/classes/class.ilMimeMail.php";
426 require_once
"include/inc.pwassist_session_handler.php";
431 if (count($pwassist_session) == 0 || $pwassist_session[
"expires"] < time())
439 $pwassist_session[
"pwassist_id"],
444 $protocol = isset($_SERVER[
'HTTPS'])?
"https://":
"http://";
446 $server_url=$protocol.$_SERVER[
'HTTP_HOST'].
447 substr($_SERVER[
'PHP_SELF'],0,strrpos($_SERVER[
'PHP_SELF'],
'/')).
453 $pwassist_url=$protocol .$_SERVER[
'HTTP_HOST']
454 .str_replace(
"ilias.php",
"pwassist.php", $_SERVER[
'PHP_SELF'])
455 .
"?client_id=".$ilias->getClientId()
456 .$delimiter.
"lang=".$lng->getLangKey()
457 .$delimiter.
"key=".$pwassist_session[
"pwassist_id"];
458 $alternative_pwassist_url=$protocol.$_SERVER[
'HTTP_HOST']
459 .str_replace(
"ilias.php",
"pwassist.php", $_SERVER[
'PHP_SELF'])
460 .
"?client_id=".$ilias->getClientId()
461 .$delimiter.
"lang=".$lng->getLangKey()
462 .$delimiter.
"key=".$pwassist_session[
"pwassist_id"];
464 $contact_address=$ilias->getSetting(
"admin_email");
467 $mm->Subject($lng->txt(
"pwassist_mail_subject"));
468 $mm->From($contact_address);
469 $mm->To($userObj->getEmail());
479 $lng->txt(
"pwassist_mail_body"),
482 $_SERVER[
'REMOTE_ADDR'],
483 $userObj->getLogin(),
485 'mailto:'.$contact_address,
486 $alternative_pwassist_url
513 include_once
"Services/Mail/classes/class.ilMailbox.php";
514 include_once
"Services/Mail/classes/class.ilMimeMail.php";
515 require_once
"include/inc.pwassist_session_handler.php";
516 $protocol = isset($_SERVER[
'HTTPS'])?
"https://":
"http://";
520 $server_url=$protocol.$_SERVER[
'HTTP_HOST'].
521 substr($_SERVER[
'PHP_SELF'],0,strrpos($_SERVER[
'PHP_SELF'],
'/')).
523 $login_url=$server_url.
"pwassist.php"
524 .
"?client_id=".$ilias->getClientId()
525 .
"&lang=".$lng->getLangKey();
527 $contact_address=$ilias->getSetting(
"admin_email");
530 $mm->Subject($lng->txt(
"pwassist_mail_subject"));
531 $mm->From($contact_address);
542 $lng->txt(
"pwassist_username_mail_body"),
543 join ($logins,
",\n"),
545 $_SERVER[
'REMOTE_ADDR'],
547 'mailto:'.$contact_address,
577 global
$tpl, $ilias,
$lng, $rbacadmin, $rbacreview;
579 require_once
"include/inc.pwassist_session_handler.php";
580 require_once
"./Services/Language/classes/class.ilLanguage.php";
583 if ($pwassist_id ==
"")
585 $pwassist_id =
$_GET[
"key"];
590 if (count($pwassist_session) == 0 || $pwassist_session[
"expires"] < time())
596 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.pwassist_assignpassword.html");
599 $tpl->setCurrentBlock(
"pw_message");
600 $tpl->setVariable(
"TXT_MESSAGE", str_replace(
"\\n",
"<br>",$message));
601 $tpl->parseCurrentBlock();
604 $tpl->setVariable(
"FORMACTION",
605 $this->ctrl->getFormAction($this));
606 $tpl->setVariable(
"TARGET",
"target=\"_parent\"");
607 $tpl->setVariable(
"IMG_AUTH",
609 $tpl->setVariable(
"TXT_PAGEHEADLINE", $lng->txt(
"password_assistance"));
610 $tpl->setVariable(
"TXT_ENTER_USERNAME_AND_NEW_PASSWORD", $lng->txt(
"pwassist_enter_username_and_new_password"));
611 $tpl->setVariable(
"TXT_USERNAME", $lng->txt(
"username"));
612 $tpl->setVariable(
"TXT_PASSWORD1", $lng->txt(
"password"));
613 $tpl->setVariable(
"TXT_PASSWORD2", $lng->txt(
"retype_password"));
614 $tpl->setVariable(
"USERNAME", $username);
615 $tpl->setVariable(
"PASSWORD1", $password1);
616 $tpl->setVariable(
"PASSWORD2", $password2);
617 $tpl->setVariable(
"TXT_SUBMIT", $lng->txt(
"submit"));
618 $tpl->setVariable(
"KEY", $pwassist_id);
619 $tpl->setVariable(
"BACK", $lng->txt(
"back"));
620 $tpl->setVariable(
"CMD_BACK",
621 $this->ctrl->getLinkTargetByClass(
"ilstartupgui",
"showLogin"));
622 $tpl->setVariable(
"LANG", $lng->getLangKey());
648 global
$tpl, $ilias,
$lng, $rbacadmin, $rbacreview;
650 require_once
"include/inc.pwassist_session_handler.php";
661 if (count($pwassist_session) == 0 || $pwassist_session[
"expires"] < time())
667 $is_successful =
true;
670 $userObj =
new ilObjUser($pwassist_session[
"user_id"]);
675 if ($userObj == null)
677 $message = $lng->txt(
"user_does_not_exist");
678 $is_successful =
false;
683 if ($is_successful && strcasecmp($userObj->getLogin(), $username) != 0)
685 $message = $lng->txt(
"pwassist_login_not_match");
686 $is_successful =
false;
691 if ($is_successful && $password1 != $password2)
693 $message = $lng->txt(
"passwd_not_match");
694 $is_successful =
false;
700 $message = $lng->txt(
"passwd_invalid");
701 $is_successful =
false;
710 $is_successful = $userObj->resetPassword($password1,$password2);
711 if (! $is_successful)
713 $message = $lng->txt(
"passwd_invalid");
721 $is_successfull = $userObj->update();
722 if (! $is_successful)
724 $message = $lng->txt(
"update_error");
740 $lng->txt(
"pwassist_password_assigned"),
768 $tpl->setCurrentBlock(
"pw_message");
769 $tpl->setVariable(
"TXT_MESSAGE", str_replace(
"\\n",
"<br>",$message));
770 $tpl->parseCurrentBlock();
773 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.pwassist_message.html");
774 $tpl->setVariable(
"TXT_PAGEHEADLINE", $lng->txt(
"password_assistance"));
775 $tpl->setVariable(
"IMG_AUTH",
777 $tpl->setVariable(
"TXT_TEXT",str_replace(
"\\n",
"<br>",$text));
778 $tpl->setVariable(
"BACK", $lng->txt(
"back"));
779 $tpl->setVariable(
"LINK_BACK",
780 $this->ctrl->getLinkTargetByClass(
"ilstartupgui",
"showLogin"));
781 $tpl->setVariable(
"LANG", $lng->getLangKey());