(root)/requestpassword.php - Rev 432
Rev 422 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
<?PHP
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This file is part of Travelsized CMS
* A content management system with modules, based on wiki syntax
*
* Author: Dan Jensen <admin@leinir.dk>
* Copyright 2003/2004
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License is available at: http://www.gnu.org/copyleft/
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
$page_author = $creator_name;
$page_author_email = $creator_email;
$page_menu = 100;
$page_date = formatTime
( time() );
$page_title = i18n
("Request new password");
$panel = new optionsPanel
("requestPassword");
$panel->showHeader = false;
$panel->saveTitle = i18n
("Continue");
$panel->resetTitle = i18n
("Clear form");
$panel->addOption( i18n
("Username"), i18n
("The username of the person you wish to request a new password for"), $username, "username", "text" );
if ( $panel->submitted && $panel->options["username"]["current"] != "")
{
$theUsername = strtolower( $panel->options["username"]["current"] );
if( $usermanager->userExists( $theUsername ) )
{
$newpassword = makeRandomPassword
();
$message = i18n
("The new password for the user ##0## is ##1##", array( $theUsername, $newpassword ) );
if (mail(getUserInfo
($theUsername, "email"), i18n
("New password"), $message, "From: " . $_SERVER['SERVER_NAME'] . "\r\n" . "X-Mailer: PHP/" . phpversion()))
{
$usermanager->changeadd($theUsername, $newpassword);
header("Location: " . globalIDtoURL
("content/$language/0") );
}
else
$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.") );
}
else
$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.") );
}
$page_content .= "<form action=\"" . globalIDtoURL
("setup/requestpassword") . "\" method=\"post\">";
$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);
$page_content .= "</form>";
?>