body<=
';
$body .= '
';
$body .= LJ::html_text( {
name => 'user',
id => 'user',
size => 20,
maxlength => 15,
value => $GET{user}, }
) . "
";
$body .= "
" . BML::ml('.no_user', { 'aopts' => "href='$LJ::SITEROOT/lostinfo.bml'" } ) . "
" if $GET{'user'};
$body .= "
" . LJ::html_submit( 'submit', $ML{'.submit_user'}, { class => "create-button" });
$body .= '';
return $body;
}
my $wrong = '';
if (LJ::did_post()) {
if (LJ::is_enabled("recaptcha")) {
if ($POST{recaptcha_response_field}) {
my $c = Captcha::reCAPTCHA->new;
my $result = $c->check_answer(
LJ::conf_test($LJ::RECAPTCHA{private_key}), $ENV{'REMOTE_ADDR'},
$POST{'recaptcha_challenge_field'}, $POST{'recaptcha_response_field'}
);
return LJ::bad_input($ML{'.captcha.invalid'}) unless $result->{'is_valid'} eq '1';
} else {
return LJ::bad_input($ML{'.captcha.invalid'});
}
}
LJ::load_user_props(
$u, { },
qw/ secret_question_timer
secret_question_fails
secret_answer/
);
my $disallowed = LJ::run_hook('may_secret', $u);
return BML::redirect("$LJ::SITEROOT/lostinfo.bml") if $disallowed;
if (LJ::trim($POST{'answer'}) eq $u->{'secret_answer'}) {
my $aa = LJ::register_authaction($u->{'userid'}, "reset_password", $u->email_raw);
return BML::redirect("$LJ::SSLROOT/changepassword.bml?auth=$aa->{aaid}.$aa->{authcode}") if $LJ::IS_SSL;
return BML::redirect("$LJ::SITEROOT/changepassword.bml?auth=$aa->{aaid}.$aa->{authcode}");
}
# failed try
$u->set_prop('secret_question_fails', 1 + $u->{'secret_question_fails'});
if ($u->{'secret_question_fails'} >= $LJ::SECRET_TRIES) {
my $datetime = gmtime; # Mon Apr 28 14:52:00 2008
if ($datetime =~ /\S+\s(\S+)\s(\S+)\s(\S+)\s(\S+)/) {
$datetime ="$4-$1-$2 $3 (UTC)";
} else {
die "Cannot understand gmtime() result";
}
LJ::send_mail({
'to' => $u->email_raw,
'from' => $LJ::ADMIN_EMAIL,
'fromname' => $LJ::SITENAME,
'charset' => 'utf-8',
'subject' => $ML{'.wrong_answer_subject'},
'body' => BML::ml('.wrong_answer_body',
{ 'remoteip' => BML::get_remote_host() . " (" . BML::get_remote_ip() . ")",
'try' => $u->{'secret_question_fails'},
'datetime' => $datetime,
'link_faq' => "$LJ::SITEROOT/support/faqbrowse.bml?faqid=17",
'link_support' => "$LJ::SITEROOT/support/",
'sitename' => $LJ::SITENAME,
'siteroot' => $LJ::SITEROOT
})
}) or die "Error: couldn't send email";
}
$wrong = "$ML{'.wrong_answer'}
";
}
my $disallowed = LJ::run_hook('may_secret', $u);
return BML::redirect("$LJ::SITEROOT/lostinfo.bml") if $disallowed;
$body = $wrong;
$body .= '' . $u->prop('secret_question_text') . '
';
$body .= '';
return $body;
}
_code?>
<=body
page?>