I hope this is helpful. This is the "email me my password" code:
[%
my $str;
$str.="Forgot your username or password? All we need is one of the f
+ollowing blanks filled in correctly and you should be able to find th
+e answers to your most perplexing question";
$str.=$query->start_form("POST", $ENV{SCRIPT_NAME});
$str.='<INPUT TYPE="hidden" NAME="op" VALUE="lostpasswd">';
$str.=$query->hidden('node_id',getId($NODE));
$str.="Your username:";
$str.='<INPUT TYPE="text" NAME="username" VALUE=""><br>';
$str.="Your e-mail address:";
$str.='<INPUT TYPE="text" NAME="email" VALUE=""><br>';
$str.=$query->submit("sexisgood", "Mail me my password, Cowboy!");
$str.=$query->end_form;
if($query->param('op') eq 'lostpasswd' and ($query->param('username'
+) || $query->param('email'))){
my $haverow=0;
my $username=$query->param('username');
my $email=$query->param('email');
my @N;
if($username){
@N = getNode($username, getType('user'));
$haverow=$N[0];
}
if(!$haverow and $email){
@N=$DB->getNodeWhere ({email => $email}, $DB->getType('user'
+));
$haverow=$N[0];
}
if($haverow){
my ($n) = getNode('Password Mail', getType('mail'));
$$n{doctext} =~ s/\<name\>/$$haverow{realname}/;
$$n{doctext} =~ s/\<user\>/$$haverow{title}/;
$$n{doctext} =~ s/\<passwd\>/$$haverow{passwd}/;
$$n{doctext} =~ s/\<site_name\>/$HTMLVARS{site_name}/;
$$n{doctext} =~ s/\<site_url\>/$HTMLVARS{site_url}/;
use Everything::MAIL;
my $addr = node2mail($$haverow{email},$n);
$n = getNodeById(getId($n), 'force');
$str.="<BR><H3>Your password and username should be on its wa
+y</H3>";
$str.= "Addr7: " . $addr;
print "<BR>$addr";
}
else{
$str="<B>Couldn't find any info that matched what you gave us
+, make sure you typed in everything correctly!</B><BR><BR>".$str;
}
}
$str;
%]
To see what is going on, gohere.
Enter apessos as the username and any email address. The code is very similar to what I have already posted. The node2mail is a package stored at /usr/local/lib/perl5/site_perl/5.6.1/Everything.
If there is any other piece of information that would be helpful, let me know. |