Here's a quick hack... no guarantees it will work as I haven't tested it.
near the top of the script:
find
Code:
elsif (param('action') eq 'post') { &post(); }
and add the following under it
Code:
elsif (param('action') eq 'pass') { &pass(); }
Now add the following to the bottom of the script
Code:
sub pass {
my (@data, $found);
open (USER, "$db_lib_path/data/portal/users.db") or die ("Could not open file 'users.db'. $!");
while (<USER>) {
/^\s*$/ and last;
chomp;
@data = split /\|/, $_;
if ($in_user eq $data[1]) { $found = 1; last; }
}
close (USER);
$found or &error("User not found. You must have your user name in order to retrieve your password");
for (my $i = 0; $i <= $#user + 1; $i++) {
$user{$user[$i]} = $login[$i];
}
require "$db_lib_path/Mailer.pm";
my $msg = &load_template('lostpassmail.txt' { %globals, %user });
$mailer = new Mailer ({
'smtp' => $db_smtp_server,
'sendmail' => $db_mail_path,
'from' => $db_admin_email,
'subject' => 'Your login information,
'to' => $user{'Email'},
'msg' => $msg,
'log' => ''
}) or return;
$mailer->send or return;
print header();
print &load_template('lostpassdisp.html', { %globals, %user });
}
Create two templates. lostpassmail.txt, which is used to as the mail template. You may use any global variable, and any fields from the user hash. lostmaildisp.html, which is used as a confirmation that the email has been sent to the user (you may use any global or user variable here, also).
from your login or registration form, you'll need to add a form.
Code:
<form action="<%db_cgi_url%>/portal.cgi" method="POST">
<input type='hidden' name='action' value='pass'>
<input type='text' name='user'>
<input type='submit' name='submit' value='submit'>
</form>
Users must supply their user name in order to recieve there password by email.
That should be about it.
Code:
s;[\d\$&(\^)];;g+s;\.; ;g+s;(.)(..);$2$1;g+print,if$_='&61k4I.)l678il.edn7(K2e^ny$';