[rt-users] Autogenerating a password for requestors

Thomas Klausner domm at cpan.org
Thu May 7 10:58:08 EDT 2009


Hi!

I've got a slightly complex question (at least to me..) and I haven't 
been able to come up with s solution after lots of googling, trying 
stuff from the wiki, etc.

My bigger goal is to set up RT so that requestors get an email 
notifying them of their ticket id etc aftre creation. If they are new 
users, they should get a autocreated password.

There is a page in the wiki on this
http://wiki.bestpractical.com/view/AutogeneratedPassword

This works when I submit a ticket via email.

But...

On our website, we have a small feedback box (yes, inspired by 
hiveminder ;-)
User can enter their problems there, which get temporarily stored in our 
DB. A cronjob than takes the proto-tickets and submits them to our RT 
via RT::Client::Rest. There we log into RT with a system user and set 
the requestor to the users email address:

  $ticket = RT::Client::REST::Ticket->new(
            rt         => $rt,
	    subject    => $subject,
            queue      => $queue,
            requestors => \@requestors,
        )->store( text => join( "\n", $subject, '', @desc ) );

This works perfectly, but not with the Password autogeneration.

After some trial and error, I figured out that RT::Client::REST seems to 
set the requestors AFTER ticket creation, thus there are no requestors 
during 'On Create'. I figured out the correct custom condition (I 
think):
return 0 unless $self->TransactionObj->Type eq 'AddWatcher';
return 0 unless $self->TransactionObj->Field eq 'Requestor';
return 1;

But I wasn't able to get template from AutogeneratedPassword
to work. I guess, some of the values used in there do not apply to this 
later stage.

So, any pointers on how do autogenerate a password right after on 
Create?

Thanks!


-- 
#!/usr/bin/perl                              http://domm.plix.at
for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}



More information about the rt-users mailing list