00001 <?PHP
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 $page_author = $creator_name;
00018 $page_author_email = $creator_email;
00019 $page_menu = 100;
00020 $page_date = formatTime( time() );
00021 $page_title = i18n("Request new password");
00022
00023 $panel = new optionsPanel("requestPassword");
00024 $panel->showHeader = false;
00025 $panel->saveTitle = i18n("Continue");
00026 $panel->resetTitle = i18n("Clear form");
00027 $panel->addOption( i18n("Username"), i18n("The username of the person you wish to request a new password for"), $username, "username", "text" );
00028
00029 if ( $panel->submitted && $panel->options["username"]["current"] != "")
00030 {
00031 if( $usermanager->userExists( $panel->options["username"]["current"] ) )
00032 {
00033 $newpassword = makeRandomPassword();
00034 $message = i18n("The new password for the user ##0## is ##1##", array( $panel->options["username"]["current"], $newpassword ) );
00035 if (mail(getUserInfo($panel->options["username"]["current"], "email"), i18n("New password"), $message, "From: " . $_SERVER['SERVER_NAME'] . "\r\n" . "X-Mailer: PHP/" . phpversion()))
00036 {
00037 $usermanager->changeadd($panel->options["username"]["current"], $newpassword);
00038 header("Location: " . globalIDtoURL("content/$language/0") );
00039 }
00040 else
00041 $page_content = renderErrorBox( i18n("Error"), i18n("An error occured while attempting to send out the new password to the provided email address! The most likely cause of this is a non-functioning email address.") );
00042 }
00043 else
00044 $page_content = renderErrorBox( i18n("Error"), i18n("There is no user on the site with the username provided below. Please try again, or contact the site administrator for further instructions.") );
00045 }
00046
00047 $page_content .= "<form action=\"" . globalIDtoURL("setup/requestpassword") . "\" method=\"post\">";
00048 $page_content .= renderQuestionBox( i18n("Request New Password"), "<p>" . i18n("You are about to request a new password. Please enter your username and confirm by clicking on the continue button below. After doing so, an email will be sent to your email address and you will be taken back to the front page. If your email address has changed or you do not receive any email containing your new password, please contact ##0##.", array( parse_profilelinks("%%admin%%" ) ) ) . "</p>" . $panel->render(), false);
00049 $page_content .= "</form>";
00050 ?>