Difference between revisions of "How to enable CAPTCHAs on your Dreamhack"

From Dreamwidth Notes
Jump to: navigation, search
 
(5 intermediate revisions by 2 users not shown)
Line 12: Line 12:
 
     );</syntaxhighlight>
 
     );</syntaxhighlight>
  
* Open <code>~/dw/ext/local/etc/config-private.pl</code> and make sure you have the following code:
+
* Open <code>~/dw/ext/local/etc/config-private.pl</code> and make sure you have the following code within the DW:PRIVATE section:
  
     %RECAPTCHA = (
+
     <syntaxhighlight lang="perl">    %RECAPTCHA = (
 
         public_key  => "key",
 
         public_key  => "key",
 
         private_key => "key",
 
         private_key => "key",
Line 22: Line 22:
 
         api_key => "demo",
 
         api_key => "demo",
 
         timeout => 10,
 
         timeout => 10,
     );
+
     );</syntaxhighlight>
 +
 
 +
* Go to [http://textcaptcha.com/ textCAPTCHA.com] and [http://www.google.com/recaptcha reCAPTCHA] to obtain keys and edit the code to add them. You only need one or the other, not necessarily both.
 +
: The 'demo' key for textcaptcha works for testing purposes.
 +
 
 +
* Edit CAPTCHA settings as you desire at <code>~/dw/ext/local/etc/config.pl</code>. If that file doesn't exist, copy <code>~/dw/etc/config.pl</code> there. To turn on CAPTCHA, make sure this bit is uncommented:
  
* Go to [http://textcaptcha.com/ textCAPTCHA.com] and [http://www.google.com/recaptcha reCAPTCHA] to obtain keys and edit the code to add them.
+
    <syntaxhighlight lang="perl">    $DISABLED{captcha} = sub {
: The 'demo' key works for testing purposes.
+
      my $module = $_[0];
 +
      return 1 if $module eq "recaptcha";
 +
      return 0 if $module eq "textcaptcha";
 +
      return 0;
 +
    };</syntaxhighlight>
  
* Edit CAPTCHA settings as you desire at <code>~/dw/ext/local/etc/config.pl</code>.
+
: And set <code>$DEFAULT_CAPTCHA_TYPE = "T";</code> to T or R as desired.
  
 
[[Category:Development]]
 
[[Category:Development]]
 
[[Category:Dreamhack]]
 
[[Category:Dreamhack]]
 
[[Category:Getting Started]]
 
[[Category:Getting Started]]

Latest revision as of 21:42, 22 March 2016

  • Open ~/dw/ext/local/etc/config-local.pl and make sure you have the following code:
    # setup recaptcha
    %RECAPTCHA = (
            public_key  => $DW::PRIVATE::RECAPTCHA{public_key},
            private_key => $DW::PRIVATE::RECAPTCHA{private_key},
    );
 
    # setup textcaptcha
    %TEXTCAPTCHA = (
            api_key => $DW::PRIVATE::TEXTCAPTCHA{api_key},
    );
  • Open ~/dw/ext/local/etc/config-private.pl and make sure you have the following code within the DW:PRIVATE section:
    %RECAPTCHA = (
        public_key  => "key",
        private_key => "key",
    );
 
    %TEXTCAPTCHA = (
        api_key => "demo",
        timeout => 10,
    );
  • Go to textCAPTCHA.com and reCAPTCHA to obtain keys and edit the code to add them. You only need one or the other, not necessarily both.
The 'demo' key for textcaptcha works for testing purposes.
  • Edit CAPTCHA settings as you desire at ~/dw/ext/local/etc/config.pl. If that file doesn't exist, copy ~/dw/etc/config.pl there. To turn on CAPTCHA, make sure this bit is uncommented:
    $DISABLED{captcha} = sub {
       my $module = $_[0];
       return 1 if $module eq "recaptcha";
       return 0 if $module eq "textcaptcha";
       return 0;
    };
And set $DEFAULT_CAPTCHA_TYPE = "T"; to T or R as desired.