Committer: akanashin
LJSUP-11624: Stage 2U trunk/cgi-bin/LJ/Widget/CreateAccount.pm
Modified: trunk/cgi-bin/LJ/Widget/CreateAccount.pm =================================================================== --- trunk/cgi-bin/LJ/Widget/CreateAccount.pm 2012-03-27 11:21:46 UTC (rev 21553) +++ trunk/cgi-bin/LJ/Widget/CreateAccount.pm 2012-03-27 11:26:22 UTC (rev 21554) @@ -5,6 +5,7 @@ use Carp qw(croak); use Class::Autouse qw( LJ::CreatePage Captcha::reCAPTCHA ); use LJ::TimeUtil; +use Digest::MD5 qw/md5_hex/; sub need_res { qw( stc/widgets/createaccount.css js/widgets/createaccount.js js/browserdetect.js ) } @@ -427,6 +428,16 @@ my $remote = LJ::get_remote(); my $alt_layout = $opts{alt_layout} ? 1 : 0; + my $userip = LJ::get_remote_ip(); + my $ua = LJ::Request->header_in ('User-Agent'); + my $mem_key = md5_hex($userip.$ua); + + if (LJ::MemCache::get($mem_key)) { + LJ::MemCache::incr($mem_key); + } else { + LJ::MemCache::set($mem_key, 1, 60*60); + } + # flag to indicate they've submitted with 'audio' as the answer to the captcha my $wants_audio = $from_post{wants_audio} = 0;