Current time: 05-23-2012, 03:52 AM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Recaptcha in Lost Password
12-26-2011, 02:43 PM (This post was last modified: 12-26-2011 06:20 PM by maozao.)
Post: #1
Solved: 4 Months, 3 Weeks, 3 Days, 4 Minutes, 47 Seconds ago Recaptcha in Lost Password
Hello.

Some spambots are attacking my forum sending a lot of Lost PW e-mails, this way my e-mail host block the service for 1 hour.

I want to add a re-captcha to that page or to allow a IP to use the Lost PW once in an hour, or anything that can stop them.

Someone can help me with that?

Thanks.
Find all posts by this user
Quote this message in a reply
12-26-2011, 08:59 PM (This post was last modified: 12-26-2011 09:04 PM by Dennis Tsang.)
Post: #2
Solved: 4 Months, 3 Weeks, 3 Days, 4 Minutes, 47 Seconds ago RE: Recaptcha in Lost Password
Ok I haven't tried this out so make sure you have appropriate backups in case it doesn't work:

First you'll need to download the recaptcha libraries from their site.
http://code.google.com/p/recaptcha/downl...lib-Latest
And put the recaptchalib.php in the inc/ folder of your forum.

In member.php, find:
PHP Code:
$plugins->run_hooks("member_lostpw"); 

Below it, add:
PHP Code:
require_once('inc/recaptchalib.php');
$publickey "your_public_key"// you got this from the signup page
$recaptcha_code recaptcha_get_html($publickey); 
You need to replace your_public_key with your recaptcha API key.

Find:
PHP Code:
$plugins->run_hooks("member_do_lostpw_start"); 

Below it, add:
PHP Code:
require_once('inc/recaptchalib.php');
  
$privatekey "your_private_key";
  
$resp recaptcha_check_answer ($privatekey,
                                
get_ip(),
                                
$_POST["recaptcha_challenge_field"],
                                
$_POST["recaptcha_response_field"]);

  if (!
$resp->is_valid) {
    
// What happens when the CAPTCHA was entered incorrectly
    
error('Die bots!!!!');
  } 
You need to replace your_private_key with your recaptcha API keys.

In your member_lostpw template, find:
Code:
<tr>
<td class="trow1" width="40%"><strong>{$lang->email_address}</strong></td>
<td class="trow1" width="60%"><input type="text" class="textbox" name="email" /></td>
</tr>
Below it, add:
Code:
<tr>
<td class="trow2"><strong>Are you human?</strong></td>
<td class="trow2">{$recaptcha_code}</td>
</tr>

Dennis Tsang :: MyBB Developer
Follow me on Twitter: @dennistt
Visit this user's website Find all posts by this user
Quote this message in a reply
12-26-2011, 09:18 PM (This post was last modified: 12-27-2011 03:47 AM by maozao.)
Post: #3
Solved: 4 Months, 3 Weeks, 3 Days, 4 Minutes, 47 Seconds ago RE: Recaptcha in Lost Password
Worked great!

Thank you so much!!!!!
Hello again.

Looks like that the spambots are sending the "Resent activation code" e-mail too.

There is a way to do something about that too?

Thank you again.
Sorry, I could fix that using the same way.

Thank you!
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | MyBB | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication