summaryrefslogtreecommitdiffstats
path: root/Token.pm
diff options
context:
space:
mode:
authorgerv%gerv.net <>2002-04-26 15:01:27 +0200
committergerv%gerv.net <>2002-04-26 15:01:27 +0200
commitb236802ccb76b57369aa650bf45aba8dbf9d3ac9 (patch)
tree9f8a83fa9e4999e7d2cc2c8dff36389da12750d7 /Token.pm
parentfe882676f7f777e1aad35665773c5a56224f63cb (diff)
downloadbugzilla-b236802ccb76b57369aa650bf45aba8dbf9d3ac9.tar.gz
bugzilla-b236802ccb76b57369aa650bf45aba8dbf9d3ac9.tar.xz
Bug 135814 - templatise Token.pm. Patch by zeroj; 2xr=bbaetz.
Diffstat (limited to 'Token.pm')
-rw-r--r--Token.pm43
1 files changed, 14 insertions, 29 deletions
diff --git a/Token.pm b/Token.pm
index 1400face9..07e5de698 100644
--- a/Token.pm
+++ b/Token.pm
@@ -114,7 +114,20 @@ sub IssuePasswordToken {
&::SendSQL("UNLOCK TABLES");
# Mail the user the token along with instructions for using it.
- MailPasswordToken($loginname, $token);
+
+ my $template = $::template;
+ my $vars = $::vars;
+
+ $vars->{'token'} = $token;
+ $vars->{'emailaddress'} = $loginname . &::Param('emailsuffix');
+
+ my $message = "";
+ $template->process("account/email/password.txt.tmpl", $vars, \$message)
+ || &::ThrowTemplateError($template->error());
+
+ open SENDMAIL, "|/usr/lib/sendmail -t -i";
+ print SENDMAIL $message;
+ close SENDMAIL;
}
@@ -153,34 +166,6 @@ sub GenerateUniqueToken {
}
-sub MailPasswordToken {
- # Emails a password token to a user along with instructions for its use.
- # Called exclusively from &IssuePasswordToken.
-
- my ($emailaddress, $token) = @_;
-
- my $urlbase = &::Param("urlbase");
- my $emailsuffix = &::Param('emailsuffix');
- $token = &::url_quote($token);
-
- open SENDMAIL, "|/usr/lib/sendmail -t -i";
-
- print SENDMAIL qq|From: bugzilla-daemon
-To: $emailaddress$emailsuffix
-Subject: Bugzilla Change Password Request
-
-You or someone impersonating you has requested to change your Bugzilla
-password. To change your password, visit the following link:
-
-${urlbase}token.cgi?a=cfmpw&t=$token
-
-If you are not the person who made this request, or you wish to cancel
-this request, visit the following link:
-
-${urlbase}token.cgi?a=cxlpw&t=$token
-|;
- close SENDMAIL;
-}
sub Cancel {
# Cancels a previously issued token and notifies the system administrator.