File tree Expand file tree Collapse file tree 2 files changed +17
-10
lines changed
web_programming/recaptcha_verification Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -40,9 +40,10 @@ sub is_valid_captcha {
40
40
return 0;
41
41
}
42
42
}
43
-
44
- # Connection to reCAPTCHA failed
45
- return 0;
43
+ else {
44
+ # Connection to reCAPTCHA failed
45
+ return 0;
46
+ }
46
47
}
47
48
48
49
# https://docs.mojolicious.org/Mojolicious/Lite#Helpers
@@ -53,15 +54,19 @@ sub is_valid_captcha {
53
54
if (($c -> param(' username' ) eq ' admin' ) && ($c -> param(' password' ) eq ' admin' )) {
54
55
return 1;
55
56
}
56
- return 0;
57
+ else {
58
+ return 0;
59
+ }
57
60
};
58
61
59
62
helper verify_captcha => sub {
60
63
my $c = shift ;
61
64
if (is_valid_captcha($c )) {
62
65
return 1;
63
66
}
64
- return 0;
67
+ else {
68
+ return 0;
69
+ }
65
70
};
66
71
67
72
helper ua => sub {
Original file line number Diff line number Diff line change 18
18
use warnings;
19
19
use Mojolicious::Lite;
20
20
use Mojo::UserAgent;
21
- use Data::Dumper;
22
21
23
22
# Add your 'Secret Key' here
24
23
$ENV {' CAPTCHA_V3_SECRET_KEY' } = " " ;
@@ -46,9 +45,10 @@ sub is_valid_captcha {
46
45
return 0;
47
46
}
48
47
}
49
-
50
- # Connection to reCAPTCHA failed
51
- return 0;
48
+ else {
49
+ # Connection to reCAPTCHA failed
50
+ return 0;
51
+ }
52
52
}
53
53
54
54
# https://docs.mojolicious.org/Mojolicious/Lite#Helpers
@@ -59,7 +59,9 @@ sub is_valid_captcha {
59
59
if (($c -> param(' username' ) eq ' admin' ) && ($c -> param(' password' ) eq ' admin' )) {
60
60
return 1;
61
61
}
62
- return 0;
62
+ else {
63
+ return 0;
64
+ }
63
65
};
64
66
65
67
helper ua => sub {
You can’t perform that action at this time.
0 commit comments