Skip to content

Commit 5828c1c

Browse files
committed
Fixed issue with recaptcha v2 and v3
1 parent 45272b4 commit 5828c1c

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

web_programming/recaptcha_verification/recaptcha_v2_verification.pl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use Mojo::UserAgent;
2121

2222
# Add your 'Secret Key' here
23-
$ENV{'CAPTCHA_V2_SECRET_KEY'} = "6LeYxBsaAAAAADckp07ST4i2KTU3--4mPFVEinLE";
23+
$ENV{'CAPTCHA_V2_SECRET_KEY'} = "";
2424

2525
sub is_valid_captcha {
2626
my ($c) = @_;
@@ -66,9 +66,7 @@ sub is_valid_captcha {
6666

6767
helper ua => sub {
6868
my $ua = Mojo::UserAgent->new;
69-
$ua->transactor->name(
70-
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:77.0) Gecko/20190101 Firefox/77.0');
71-
$ua->insecure(1);
69+
$ua->transactor->name('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:77.0) Gecko/20190101 Firefox/77.0');
7270
return $ua;
7371
};
7472

@@ -119,7 +117,6 @@ sub is_valid_captcha {
119117
@@ index.html.ep
120118
<html>
121119
<head>
122-
<link href="https://fonts.googleapis.com/css?family=Nunito:200,600" rel="stylesheet">
123120
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
124121
</head>
125122
<body>
@@ -134,7 +131,7 @@ sub is_valid_captcha {
134131
<br /><br />
135132
<label>password:</label> <%= password_field 'password' %>
136133
<br /><br />
137-
<div class="g-recaptcha" data-sitekey="6LeYxBsaAAAAAEFYISkPQh7t5MptnN0YpkQaVNn6"></div>
134+
<div class="g-recaptcha" data-sitekey="<Your Site Key>"></div>
138135
%= submit_button 'Log in', id => 'submit'
139136
%= end
140137
</body>

web_programming/recaptcha_verification/recaptcha_v3_verification.pl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use warnings;
1919
use Mojolicious::Lite;
2020
use Mojo::UserAgent;
21+
use Data::Dumper;
2122

2223
# Add your 'Secret Key' here
2324
$ENV{'CAPTCHA_V3_SECRET_KEY'} = "";
@@ -119,8 +120,6 @@ sub is_valid_captcha {
119120
@@ index.html.ep
120121
<html>
121122
<head>
122-
<link href="https://fonts.googleapis.com/css?family=Nunito:200,600" rel="stylesheet">
123-
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
124123
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=<Your Site Key>"></script>
125124
</head>
126125
<body>

0 commit comments

Comments
 (0)