
On Thu, 13 Mar 2003, Strange, PJ (Philippa) wrote:
additional to previous email
The 'lost your password' functionality is on the customer login but only works with existing customers.
Would it be possible to remove the customer choose password and have the system create the new account then post the password to the customers email address?
First, many thanks for otrs, we just love it. It is a major improvement over the web form to mailing list mess we used to have. And now on to the content. Here's what I use to 'inject' customer usernames into the otrs, we wanted their customer id to be their email address, always and forever: When a person sends mail to otrs@, their email address gets added to the customer_user table. We then tell them to go to the customer interface and request a new password. I'm sure it wouldn't be too tough to change this around to create the password for them and mail it with Net:SMTP. In .procmailrc: # -- # Example for assigning the "email as customer ID" automaticaly. # -- :0hc CUSTOMERID=|formail -X "From:"|perl -e '$i=<STDIN>; $i=~s/\(.*?\)//; $i=~s/.+?([\w\-\&\.]+\@[\w\-\&\.]+)(.+?|)/$1/g; print $i' :0hc | /opt/otrs/bin/inject-otrs.pl $CUSTOMERID #--Begin perl-- #!/usr/bin/perl # inject-otrs.pl use DBI; use DBD::mysql; $databasehost = 'localhost'; $database = 'otrs'; $user = 'otrs'; $pw = 'notmypassword'; $dbh = DBI->connect("DBI:mysql:$database", $user, $pw); #If I already exist, don't add me: $exists = 0; $emailaddress = $ARGV[0]; $emailaddress =~ tr/A-Z/a-z/; ($username,$domain) = split('\@',$emailaddress); $statement = "select * from customer_user where login = '$username'"; #print "$statement\n"; $sth = $dbh->prepare($statement) or die "Can't prepare $statement: $dbh->errstr\n"; $rv = $sth->execute(); while(@row = $sth->fetchrow_array) { if ($row[0] ne '0') { $exists = 1; #print "$emailaddress already exists\n"; } } $sth->finish(); # I don't exist, add me if ($exists == 0) { print "$emailaddress does not exist, inserting\n"; $statement = "insert into customer_user (login, customer_id, email, valid_id, create_time, comment) values('$username','$emailaddress','$emailaddress','1', NOW(), 'New Customer Insert')"; print "$statement\n"; $sth = $dbh->prepare($statement) or die "Can't prepare $statement: $dbh->errstr\n"; $rv = $sth->execute(); $sth->finish; } $dbh->disconnect(); #----End Perl Not for the faint of heart, but it works for us. -- Corey Betka