Autogenerating password

Hi,

We run RT 3.0.10 and have found a script on this e-mail list for auto
generation of password for users who send a message to RT for the first
time. There seems to be a problem though, because we don’t receive areply message with the new generated password.

This is the scrip we run:

----------start code-------------
{
my $tmplName = ‘RT_PasswordChange’; ## hardwired template name
my ($user) = $self->TransactionObj->CreatorObj;
if (($user->id != $RT::Nobody->id) && (!$user->Privileged) &&
$user->__Value(‘Password’) eq ‘NO-PASSWORD’ && $user->Name =~
/@/) {
my ($stat, $pass) =
$self->TransactionObj->CreatorObj->SetRandomPassword();
if ($stat) {
my $template = RT::Template->new( $user->CurrentUser );
$template->LoadGlobalTemplate($tmplName);
unless ($template->Id) {
$RT::Logger->crit( “$user tried to send “. $user->Name .
” a password reminder, but couldn’t find tmpl: $tmplName”);
die “failed to load $tmplName template”;
}
my $notification = RT::Action::SendEmail->new(
TemplateObj => $template,
TransactionObj => $self->TransactionObj,
TicketObj => $self->TicketObj,
ScripObj => $self->ScripObj,
Argument => $pass);
@{ $notification->{‘To’} } = ( $user->EmailAddress );
my ($ret) = $notification->Prepare();
$ret = $notification->Commit() if $ret;
$RT::Logger->crit(“Set Password scrip: $user: SendEmail failed
sending “.
$user->Name . " the password setting reminder.”)
unless ($ret);
} else {
$RT::Logger->crit(“Set Password Scrip: Failed to set password for:
””.
$user->Name."", pass=".$pass);
}
}
1;
}
----------------end scrip code-----------------

I hope someone can tell me what might be the problem or that someone can
send me a script that works with RT 3.0.10

Hilde

Hilde Therese Lauvset wrote:

Hi,

We run RT 3.0.10 and have found a script on this e-mail list for auto
generation of password for users who send a message to RT for the first
time. There seems to be a problem though, because we don�t receive a
reply message with the new generated password.
Where is logs? Errors? If it’s in ML then it works for somebody.
Do you have template ‘RT_PasswordChange’?

See also: http://wiki.bestpractical.com/index.cgi?AutogeneratedPassword