summaryrefslogtreecommitdiffstats
path: root/token.cgi
diff options
context:
space:
mode:
authorgerv%gerv.net <>2002-03-16 08:23:10 +0100
committergerv%gerv.net <>2002-03-16 08:23:10 +0100
commit9ff5677ed0e31bbd9ee290d19833d57fcea0a00d (patch)
treee598d781cf6d88ef6dcc6ca2ecf51886cd7b538d /token.cgi
parent300e2cb33e951ea685bca78a047f485216ef5900 (diff)
downloadbugzilla-9ff5677ed0e31bbd9ee290d19833d57fcea0a00d.tar.gz
bugzilla-9ff5677ed0e31bbd9ee290d19833d57fcea0a00d.tar.xz
Bug 126789 - templatise token.cgi. r=bbaetz, mattyt.
Diffstat (limited to 'token.cgi')
-rwxr-xr-xtoken.cgi90
1 files changed, 29 insertions, 61 deletions
diff --git a/token.cgi b/token.cgi
index 7e20d7483..d0de17baa 100755
--- a/token.cgi
+++ b/token.cgi
@@ -30,6 +30,8 @@ use strict;
use lib qw(.);
+use vars qw($template $vars);
+
# Include the Bugzilla CGI and general utility library.
require "CGI.pl";
@@ -144,72 +146,42 @@ exit;
################################################################################
sub requestChangePassword {
-
Token::IssuePasswordToken($::FORM{'loginname'});
- # Return HTTP response headers.
- print "Content-Type: text/html\n\n";
+ $vars->{'title'} = "Request to Change Password";
+ $vars->{'message'} = "A token for changing your password has been
+ emailed to you. Follow the instructions in
+ that email to change your password.";
- PutHeader("Request to Change Password");
- print qq|
- <p>
- A token for changing your password has been emailed to you.
- Follow the instructions in that email to change your password.
- </p>
- |;
- PutFooter();
+ print "Content-Type: text/html\n\n";
+ $template->process("global/message.html.tmpl", $vars)
+ || DisplayError("Template process failed: " . $template->error())
+ && exit;
}
sub confirmChangePassword {
-
- # Return HTTP response headers.
+ $vars->{'title'} = "Change Password";
+ $vars->{'token'} = $::token;
+
print "Content-Type: text/html\n\n";
-
- PutHeader("Change Password");
- print qq|
- <p>
- To change your password, enter a new password twice:
- </p>
- <form method="post" action="token.cgi">
- <input type="hidden" name="t" value="$::token">
- <input type="hidden" name="a" value="chgpw">
- <table>
- <tr>
- <th align="right">New Password:</th>
- <td><input type="password" name="password" size="16" maxlength="16"></td>
- </tr>
- <tr>
- <th align="right">New Password Again:</th>
- <td><input type="password" name="matchpassword" size="16" maxlength="16"></td>
- </tr>
- <tr>
- <th align="right">&nbsp;</th>
- <td><input type="submit" value="Submit"></td>
- </tr>
- </table>
- </form>
- |;
- PutFooter();
+ $template->process("admin/change-password.html.tmpl", $vars)
+ || DisplayError("Template process failed: " . $template->error())
+ && exit;
}
-sub cancelChangePassword {
-
+sub cancelChangePassword {
Token::Cancel($::token, "user requested cancellation");
- # Return HTTP response headers.
- print "Content-Type: text/html\n\n";
+ $vars->{'title'} = "Cancel Request to Change Password";
+ $vars->{'message'} = "Your request has been cancelled.";
- PutHeader("Cancel Request to Change Password");
- print qq|
- <p>
- Your request has been cancelled.
- </p>
- |;
- PutFooter();
+ print "Content-Type: text/html\n\n";
+ $template->process("global/message.html.tmpl", $vars)
+ || DisplayError("Template process failed: " . $template->error())
+ && exit;
}
sub changePassword {
-
# Quote the password and token for inclusion into SQL statements.
my $cryptedpassword = Crypt($::FORM{'password'});
my $quotedpassword = SqlQuote($cryptedpassword);
@@ -229,17 +201,13 @@ sub changePassword {
InvalidateLogins($userid);
- # Return HTTP response headers.
- print "Content-Type: text/html\n\n";
+ $vars->{'title'} = "Password Changed";
+ $vars->{'message'} = "Your password has been changed.";
- # Let the user know their password has been changed.
- PutHeader("Password Changed");
- print qq|
- <p>
- Your password has been changed.
- </p>
- |;
- PutFooter();
+ print "Content-Type: text/html\n\n";
+ $template->process("global/message.html.tmpl", $vars)
+ || DisplayError("Template process failed: " . $template->error())
+ && exit;
}