last page -- forgot password -- converted!

This commit is contained in:
Ryan Walberg 2012-11-17 05:00:51 +00:00
parent f346967184
commit 75aefbd9e3
2 changed files with 94 additions and 67 deletions

View file

@ -55,72 +55,15 @@ if (isset($_POST["action"])) {
}
}
}
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Gift Registry - Forgot Password</title>
<link href="styles.css" type="text/css" rel="stylesheet" />
<script language="JavaScript" type="text/javascript">
function validate() {
field = document.forgot.username;
if (field == null || field == undefined || !field.value.match("\\S")) {
alert("You must supply a username.");
field.focus();
return false;
}
return true;
}
</script>
</head>
<body>
<?php
if (isset($_POST["action"]) && $_POST["action"] == "forgot" && $error == "") {
// success!
?>
<p>
Shortly, you will receive an e-mail with your new password.</p>
<p>Once you've received your password, click <a href="login.php">here</a> to login.</p>
<?php
} else {
?>
<form name="forgot" method="post" action="forgot.php">
<input type="hidden" name="action" value="forgot">
<div align="center">
<table cellpadding="3" class="partbox" width="50%">
<tr>
<td colspan="2" class="partboxtitle" align="center">Retrieve Your Password</td>
</tr>
<tr>
<td colspan="2">
<p>
Supply your username and click Submit.
Your password will be reset and the new password will be sent to the e-mail address you have associated with your account.
</p>
<?php
if ($error != "")
echo "<div class=\"message\">" . $error . "</div>";
?>
</td>
</tr>
<tr>
<td width="25%">Username</td>
<td>
<input name="username" size="20" maxlength="20" type="text" value="<?php echo htmlspecialchars(stripslashes($_POST["username"])); ?>"/>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Submit" onClick="return validate();" />
</td>
</tr>
</table>
</div>
</form>
<?php
define('SMARTY_DIR',str_replace("\\","/",getcwd()).'/includes/Smarty-3.1.12/libs/');
require_once(SMARTY_DIR . 'Smarty.class.php');
$smarty = new Smarty();
if (isset($error) && $error != "") {
$smarty->assign('error', $error);
}
$smarty->assign('action', $_POST["action"]);
$smarty->assign('username', $username);
$smarty->assign('opt', $OPT);
$smarty->display('forgot.tpl');
?>
</body>
</html>

84
src/templates/forgot.tpl Normal file
View file

@ -0,0 +1,84 @@
{*
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Gift Registry - Forgot Password</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<script language="JavaScript" type="text/javascript">
function validate() {
field = document.forgot.username;
if (field == null || field == undefined || !field.value.match("\\S")) {
alert("You must supply a username.");
field.focus();
return false;
}
return true;
}
</script>
</head>
<body>
<div class="container" style="padding-top: 30px;">
{if isset($action) && $action == "forgot" && $error == ""}
<div class="row">
<div class="span12">
<div class="well">
<p>Shortly, you will receive an e-mail with your new password.</p>
<p>Once you've received your password, click <a href="login.php">here</a> to login.</p>
</div>
</div>
</div>
{else}
<div class="row">
<div class="span12">
<form name="forgot" method="post" action="forgot.php" class="well form-horizontal">
<input type="hidden" name="action" value="forgot">
<fieldset>
<legend>Reset Your Password</legend>
<div class="control-group {if isset($error)}warning{/if}">
<label class="control-label" for="username">Username</label>
<div class="controls">
<input id="username" name="username" type="text" class="input-xlarge" value="{$username|escape:'htmlall'}">
{if isset($error)}
<span class="help-inline">{$error|escape:'htmlall'}</span>
{/if}
<p class="help-block">
Supply your username and click Submit.<br />
Your password will be reset and the new password will be sent to the e-mail address you have associated with your account.
</p>
</p>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary" onClick="return validate();">Submit</button>
<button type="button" class="btn" onClick="document.location.href=='login.php';">Cancel</button>
</div>
</fieldset>
</form>
</div>
</div>
{/if}
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
</body>
</html>