From 9ff5677ed0e31bbd9ee290d19833d57fcea0a00d Mon Sep 17 00:00:00 2001 From: "gerv%gerv.net" <> Date: Sat, 16 Mar 2002 07:23:10 +0000 Subject: Bug 126789 - templatise token.cgi. r=bbaetz, mattyt. --- template/default/admin/change-password.html.tmpl | 54 ++++++++++++++ token.cgi | 90 ++++++++---------------- 2 files changed, 83 insertions(+), 61 deletions(-) create mode 100644 template/default/admin/change-password.html.tmpl diff --git a/template/default/admin/change-password.html.tmpl b/template/default/admin/change-password.html.tmpl new file mode 100644 index 000000000..d3c8f42a0 --- /dev/null +++ b/template/default/admin/change-password.html.tmpl @@ -0,0 +1,54 @@ + [%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Bug Tracking System. + # + # The Initial Developer of the Original Code is Netscape Communications + # Corporation. Portions created by Netscape are + # Copyright (C) 1998 Netscape Communications Corporation. All + # Rights Reserved. + # + # Contributor(s): Gervase Markham + #%] + +[% INCLUDE global/header %] + +

+ To change your password, enter a new password twice: +

+ +
+ + + + + + + + + + + + + + + + + +
New Password: + +
New Password Again: + +
  + +
+
+ +[% INCLUDE global/footer %] 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| -

- A token for changing your password has been emailed to you. - Follow the instructions in that email to change your password. -

- |; - 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| -

- To change your password, enter a new password twice: -

-
- - - - - - - - - - - - - - - -
New Password:
New Password Again:
 
-
- |; - 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| -

- Your request has been cancelled. -

- |; - 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| -

- Your password has been changed. -

- |; - PutFooter(); + print "Content-Type: text/html\n\n"; + $template->process("global/message.html.tmpl", $vars) + || DisplayError("Template process failed: " . $template->error()) + && exit; } -- cgit v1.2.1