Difference between revisions of "AutogeneratedPassword"

From Request Tracker Wiki
Jump to navigation Jump to search
m (2 revisions imported)
m (Fix formatting)
 
Line 9: Line 9:
 
Note: fixed variable case error below as described at http://gossamer-threads.com/lists/rt/users/26492?search_string=password;#26492
 
Note: fixed variable case error below as described at http://gossamer-threads.com/lists/rt/users/26492?search_string=password;#26492
  
'
+
<pre><nowiki>Subject: AutoReply: {$Ticket-&gt;Subject}
 
 
<nowiki>Subject: AutoReply: {$Ticket-&gt;Subject}
 
 
   
 
   
 
   
 
   
Line 78: Line 76:
 
  -------------------------------------------------------------------------
 
  -------------------------------------------------------------------------
 
  {$Transaction-&gt;Content()}
 
  {$Transaction-&gt;Content()}
  </nowiki>
+
  </nowiki></pre>
 
 
'
 

Latest revision as of 11:36, 14 July 2016

Solution for User Password + Viewing ticket status

The following template will send users an auto-generated random pronounceable password if inserted into an autoreply template. Users who have previously submitted tickets but not yet had a password assigned will have a password assigned and sent on submission of their first new ticket. (All previous tickets will still show up in the web ui) --JesseVincent

Add this line to the if statement if you do not want to auto generate a password for people that logon using ldap credentials from your domain. I had to do this because I am using RT::Authen::ExternalAuth.

($Ticket->RequestorAddresses !~ m/domain.com$/i) &&

Note: fixed variable case error below as described at http://gossamer-threads.com/lists/rt/users/26492?search_string=password;#26492

Subject: AutoReply: {$Ticket->Subject}
 
 
 Greetings,
 
 This message has been automatically generated in response to the
 creation of a helpdesk call:
 
         "{$Ticket->Subject()}",
 
 a summary of which appears below.
 
 There is no need to reply to this message right now. Your ticket has been
  assigned an ID of [{$rtname} #{$Ticket->id()}]. Please include this string
 in the subject line of all future correspondence about this issue.
 
 {
 *RT::User::GenerateRandomNextChar = \&RT::User::_GenerateRandomNextChar;
 
 
 if (($Transaction->CreatorObj->id != $RT::Nobody->id) &&
     (!$Transaction->CreatorObj->Privileged) &&
     ($Transaction->CreatorObj->__Value('Password') eq '*NO-PASSWORD*')
     ) {
 
 
 
         my $user = RT::User->new($RT::SystemUser);
         $user->Load($Transaction->CreatorObj->Id);
         my ($stat, $pass) = $user->SetRandomPassword();
 
 
 
         if (!$stat) {
                 $OUT .=
 
 "An internal error has occurred. RT was not able to set a password for you.
 Please contact your local RT administrator for assistance.";
 
 
         }
 
 
 $OUT .= "
 You can check the current status and history of your requests at:
 
 
         ".$RT::WebURL."
 
 
 When prompted, enter the following username and password:
 
 
         Username: ".$user->Name."
         Password: ".$pass."
 
 ";
 }
 }
 
 
                         Thank you.
                         {$Ticket->QueueObj->CorrespondAddress()}
 
 
 -------------------------------------------------------------------------
 {$Transaction->Content()}