[Rt-commit] r7848 - in rt/branches/3.7-EXPERIMENTAL: lib/RT
clkao at bestpractical.com
clkao at bestpractical.com
Sun May 13 10:56:19 EDT 2007
Author: clkao
Date: Sun May 13 10:56:18 2007
New Revision: 7848
Modified:
rt/branches/3.7-EXPERIMENTAL/etc/initialdata
rt/branches/3.7-EXPERIMENTAL/lib/RT/User_Overlay.pm
Log:
Make the (uniused) User->ResetPassword API actually work.
Modified: rt/branches/3.7-EXPERIMENTAL/etc/initialdata
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/etc/initialdata (original)
+++ rt/branches/3.7-EXPERIMENTAL/etc/initialdata Sun May 13 10:56:18 2007
@@ -438,6 +438,20 @@
}
}}
},
+ { Queue => 0,
+ Name => "PasswordChange", # loc
+ Description =>
+ "Inform user that his password has been reset", # loc
+ Content => q{Subject: [{RT->Config->Get('rtname')}] Password reset
+
+Greetings,
+
+Someone at {$ENV{'REMOTE_ADDR'}} requested a password reset for you on {RT->Config->Get('WebURL')}
+
+Your new password is:
+ {$NewPassword}
+}
+ },
);
# }}}
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/User_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/User_Overlay.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/User_Overlay.pm Sun May 13 10:56:18 2007
@@ -708,38 +708,13 @@
return ( 0, "$pass" );
}
- my $template = RT::Template->new( $self->CurrentUser );
-
- if ( $self->Privileged ) {
- $template->LoadGlobalTemplate('RT_PasswordChange_Privileged');
- }
- else {
- $template->LoadGlobalTemplate('RT_PasswordChange_NonPrivileged');
- }
-
- unless ( $template->Id ) {
- $template->LoadGlobalTemplate('RT_PasswordChange');
- }
-
- unless ( $template->Id ) {
- $RT::Logger->crit( "$self tried to send "
- . $self->Name
- . " a password reminder "
- . "but couldn't find a password change template" );
- }
-
- my $notification = RT::Action::SendPasswordEmail->new(
- TemplateObj => $template,
- Argument => $pass
- );
-
- $notification->SetHeader( 'To', $self->EmailAddress );
-
- my ($ret);
- $ret = $notification->Prepare();
- if ($ret) {
- $ret = $notification->Commit();
- }
+ my $ret = RT::Interface::Email::SendEmailUsingTemplate(
+ To => $self->EmailAddress,
+ Template => 'PasswordChange',
+ Arguments => {
+ NewPassword => $pass,
+ },
+ );
if ($ret) {
return ( 1, $self->loc('New password notification sent') );
More information about the Rt-commit
mailing list