[rt-users] Autogenerating password

Hilde Therese Lauvset Hilde.Lauvset at cc.uit.no
Thu Oct 21 05:48:24 EDT 2004


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.

 

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

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20041021/e50cc61a/attachment.htm>


More information about the rt-users mailing list