34 if (!$ilSetting->get(
"password_assistance"))
38 $ilErr->raiseError($lng->txt(
"permission_denied"),$ilias->error_obj->WARNING);
43 if (!$ilSetting->get(
"setup_ok"))
45 die(
"Setup is not completed. Please run setup routine again. (pwassist.php)");
55 $lng->loadLanguageModule(
'pwassist');
57 $cmd = $this->ctrl->getCmd();
58 $next_class = $this->ctrl->getNextClass($this);
69 if (!empty(
$_GET[
"key"])) {
104 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.startup_screen.html",
"Services/Init");
106 $tpl->addBlockFile(
"STARTUP_CONTENT",
"startup_content",
107 "tpl.pwassist_assistance.html",
"Services/Init");
111 $tpl->setCurrentBlock(
"pw_message");
112 $tpl->setVariable(
"TXT_MESSAGE", str_replace(
"\\n",
"<br>",$message));
113 $tpl->parseCurrentBlock();
116 $tpl->setVariable(
"FORMACTION",
117 $this->ctrl->getFormAction($this));
118 $tpl->setVariable(
"TARGET",
"target=\"_parent\"");
119 $tpl->setVariable(
"IMG_AUTH",
121 $tpl->setVariable(
"TXT_PAGEHEADLINE", $lng->txt(
"password_assistance"));
123 $contact_address = $ilias->getSetting(
"admin_email");
126 "TXT_ENTER_USERNAME_AND_EMAIL",
132 $lng->txt(
"pwassist_enter_username_and_email"),
133 "<a href=\"mailto:".$contact_address.
"\">".$contact_address.
"</a>"
137 $tpl->setVariable(
"TXT_USERNAME", $lng->txt(
"username"));
138 $tpl->setVariable(
"TXT_EMAIL", $lng->txt(
"email"));
141 $tpl->setVariable(
"TXT_SUBMIT", $lng->txt(
"submit"));
142 $tpl->setVariable(
"BACK", $lng->txt(
"back"));
143 $tpl->setVariable(
"LINK_BACK",
144 $this->ctrl->getLinkTargetByClass(
"ilstartupgui",
"showLogin"));
145 $tpl->setVariable(
"LANG", $lng->getLangKey());
170 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.startup_screen.html",
"Services/Init");
172 $tpl->addBlockFile(
"STARTUP_CONTENT",
"startup_content",
173 "tpl.pwassist_username_assistance.html",
"Services/Init");
178 $tpl->setCurrentBlock(
"pw_message");
179 $tpl->setVariable(
"TXT_MESSAGE", str_replace(
"\\n",
"<br>",$message));
180 $tpl->parseCurrentBlock();
183 $tpl->setVariable(
"FORMACTION",
184 $this->ctrl->getFormAction($this));
185 $tpl->setVariable(
"IMG_AUTH",
187 $tpl->setVariable(
"TARGET",
"target=\"_parent\"");
188 $tpl->setVariable(
"TXT_PAGEHEADLINE", $lng->txt(
"password_assistance"));
190 $contact_address = $ilias->getSetting(
"admin_email");
193 "TXT_ENTER_USERNAME_AND_EMAIL",
199 $lng->txt(
"pwassist_enter_email"),
200 "<a href=\"mailto:".$contact_address.
"\">".$contact_address.
"</a>"
204 $tpl->setVariable(
"TXT_USERNAME", $lng->txt(
"username"));
205 $tpl->setVariable(
"TXT_EMAIL", $lng->txt(
"email"));
208 $tpl->setVariable(
"TXT_SUBMIT", $lng->txt(
"submit"));
209 $tpl->setVariable(
"BACK", $lng->txt(
"back"));
210 $tpl->setVariable(
"LINK_BACK",
211 $this->ctrl->getLinkTargetByClass(
"ilstartupgui",
"showLogin"));
212 $tpl->setVariable(
"LANG", $lng->getLangKey());
231 global
$tpl, $ilias,
$lng, $rbacadmin, $rbacreview;
233 require_once
'./Services/User/classes/class.ilObjUser.php';
234 require_once
"./Services/Utilities/classes/class.ilUtil.php";
243 $txt_key =
"pwassist_invalid_username_or_email";
247 if (strcasecmp($userObj->getEmail(), $email) != 0)
251 elseif(!strlen($email))
254 $txt_key =
'pwassist_no_email_found';
256 else if ($userObj->getAuthMode(
true) !=
AUTH_LOCAL ||
257 ($userObj->getAuthMode(
true) == AUTH_DEFAULT && AUTH_DEFAULT !=
AUTH_LOCAL))
260 $txt_key =
"pwassist_invalid_auth_mode";
266 if ($userObj == null)
285 if ($rbacreview->isAssigned($userObj->getID, ANONYMOUS_ROLE_ID)
286 || $rbacreview->isAssigned($userObj->getID, SYSTEM_ROLE_ID)
291 $lng->txt(
"pwassist_not_permitted"),
304 $lng->txt(
"pwassist_mail_sent"),
326 global
$tpl, $ilias,
$lng, $rbacadmin, $rbacreview;
328 require_once
'./Services/User/classes/class.ilObjUser.php';
329 require_once
"./Services/Utilities/classes/class.ilUtil.php";
339 if (count($logins)< 1)
343 $lng->txt(
"pwassist_invalid_email"),
348 elseif(!strlen($email))
352 $lng->txt(
"pwassist_invalid_email"),
386 $lng->txt(
"pwassist_mail_sent"),
411 include_once
"Services/Mail/classes/class.ilMailbox.php";
412 include_once
"Services/Mail/classes/class.ilMimeMail.php";
414 require_once
"include/inc.pwassist_session_handler.php";
419 if (count($pwassist_session) == 0 || $pwassist_session[
"expires"] < time() ||
true)
430 $pwassist_session[
"pwassist_id"],
435 $protocol = isset($_SERVER[
'HTTPS'])?
"https://":
"http://";
437 $server_url=$protocol.$_SERVER[
'HTTP_HOST'].
438 substr($_SERVER[
'PHP_SELF'],0,strrpos($_SERVER[
'PHP_SELF'],
'/')).
444 $pwassist_url=$protocol .$_SERVER[
'HTTP_HOST']
445 .str_replace(
"ilias.php",
"pwassist.php", $_SERVER[
'PHP_SELF'])
446 .
"?client_id=".$ilias->getClientId()
447 .$delimiter.
"lang=".$lng->getLangKey()
448 .$delimiter.
"key=".$pwassist_session[
"pwassist_id"];
449 $alternative_pwassist_url=$protocol.$_SERVER[
'HTTP_HOST']
450 .str_replace(
"ilias.php",
"pwassist.php", $_SERVER[
'PHP_SELF'])
451 .
"?client_id=".$ilias->getClientId()
452 .$delimiter.
"lang=".$lng->getLangKey()
453 .$delimiter.
"key=".$pwassist_session[
"pwassist_id"];
455 $contact_address=$ilias->getSetting(
"admin_email");
458 $mm->Subject($lng->txt(
"pwassist_mail_subject"));
459 $mm->From($contact_address);
460 $mm->To($userObj->getEmail());
470 $lng->txt(
"pwassist_mail_body"),
473 $_SERVER[
'REMOTE_ADDR'],
474 $userObj->getLogin(),
476 'mailto:'.$contact_address,
477 $alternative_pwassist_url
504 include_once
"Services/Mail/classes/class.ilMailbox.php";
505 include_once
"Services/Mail/classes/class.ilMimeMail.php";
506 require_once
"include/inc.pwassist_session_handler.php";
507 $protocol = isset($_SERVER[
'HTTPS'])?
"https://":
"http://";
511 $server_url=$protocol.$_SERVER[
'HTTP_HOST'].
512 substr($_SERVER[
'PHP_SELF'],0,strrpos($_SERVER[
'PHP_SELF'],
'/')).
514 $login_url=$server_url.
"pwassist.php"
515 .
"?client_id=".$ilias->getClientId()
516 .
"&lang=".$lng->getLangKey();
518 $contact_address=$ilias->getSetting(
"admin_email");
521 $mm->Subject($lng->txt(
"pwassist_mail_subject"));
522 $mm->From($contact_address);
533 $lng->txt(
"pwassist_username_mail_body"),
534 join ($logins,
",\n"),
536 $_SERVER[
'REMOTE_ADDR'],
538 'mailto:'.$contact_address,
568 global
$tpl, $ilias,
$lng, $rbacadmin, $rbacreview;
570 require_once
"include/inc.pwassist_session_handler.php";
571 require_once
"./Services/Language/classes/class.ilLanguage.php";
574 if ($pwassist_id ==
"")
576 $pwassist_id =
$_GET[
"key"];
581 if (count($pwassist_session) == 0 || $pwassist_session[
"expires"] < time())
587 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.startup_screen.html",
"Services/Init");
589 $tpl->addBlockFile(
"STARTUP_CONTENT",
"startup_content",
590 "tpl.pwassist_assignpassword.html",
"Services/Init");
595 $tpl->setCurrentBlock(
"pw_message");
596 $tpl->setVariable(
"TXT_MESSAGE", str_replace(
"\\n",
"<br>",$message));
597 $tpl->parseCurrentBlock();
600 $tpl->setVariable(
"FORMACTION",
601 $this->ctrl->getFormAction($this));
602 $tpl->setVariable(
"TARGET",
"target=\"_parent\"");
603 $tpl->setVariable(
"IMG_AUTH",
605 $tpl->setVariable(
"TXT_PAGEHEADLINE", $lng->txt(
"password_assistance"));
606 $tpl->setVariable(
"TXT_ENTER_USERNAME_AND_NEW_PASSWORD", $lng->txt(
"pwassist_enter_username_and_new_password"));
607 $tpl->setVariable(
"TXT_USERNAME", $lng->txt(
"username"));
608 $tpl->setVariable(
"TXT_PASSWORD1", $lng->txt(
"password"));
609 $tpl->setVariable(
"TXT_PASSWORD2", $lng->txt(
"retype_password"));
613 $tpl->setVariable(
"TXT_SUBMIT", $lng->txt(
"submit"));
614 $tpl->setVariable(
"KEY", $pwassist_id);
615 $tpl->setVariable(
"BACK", $lng->txt(
"back"));
616 $tpl->setVariable(
"CMD_BACK",
617 $this->ctrl->getLinkTargetByClass(
"ilstartupgui",
"showLogin"));
618 $tpl->setVariable(
"LANG", $lng->getLangKey());
644 global
$tpl, $ilias,
$lng, $rbacadmin, $rbacreview;
646 require_once
"include/inc.pwassist_session_handler.php";
657 if (count($pwassist_session) == 0 || $pwassist_session[
"expires"] < time())
663 $is_successful =
true;
666 $userObj =
new ilObjUser($pwassist_session[
"user_id"]);
671 if ($userObj == null)
673 $message = $lng->txt(
"user_does_not_exist");
674 $is_successful =
false;
679 if ($is_successful && strcasecmp($userObj->getLogin(), $username) != 0)
681 $message = $lng->txt(
"pwassist_login_not_match");
682 $is_successful =
false;
687 if ($is_successful && $password1 != $password2)
689 $message = $lng->txt(
"passwd_not_match");
690 $is_successful =
false;
696 $message = $lng->txt(
"passwd_invalid");
697 $is_successful =
false;
706 $is_successful = $userObj->resetPassword($password1,$password2);
707 if (! $is_successful)
709 $message = $lng->txt(
"passwd_invalid");
717 $is_successfull = $userObj->update();
718 if (! $is_successful)
720 $message = $lng->txt(
"update_error");
736 $lng->txt(
"pwassist_password_assigned"),
764 $tpl->setCurrentBlock(
"pw_message");
765 $tpl->setVariable(
"TXT_MESSAGE", str_replace(
"\\n",
"<br>",$message));
766 $tpl->parseCurrentBlock();
769 $tpl->addBlockFile(
"CONTENT",
"content",
"tpl.startup_screen.html",
"Services/Init");
771 $tpl->addBlockFile(
"STARTUP_CONTENT",
"startup_content",
772 "tpl.pwassist_message.html",
"Services/Init");
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());