hCaptcha for SMF

Started by vbgamer45, April 14, 2020, 11:12:56 AM

Previous topic - Next topic

vbgamer45

Link to the mod

hCaptcha for SMF

About

hCaptcha is degined to keep out bots, protects user privacy and rewards website owners.

This modification allows you to use hCaptcha instead of the built-in Visual Verification system. It supports the SMF 2.0.x and 2.1.x series.

Features

  • Use hCaptcha on your forum in place of or in combination with the built-in verification options.
  • Support for built-in hCaptcha themes

How to Use

You can enable hCaptcha by going to:

Admin -> Configuration -> Security and Moderation -> Anti-Spam

A set of keys are required for operation of hCaptcha A link is provided in the settings to register for a key pair.

Known Issues

  • The error messages are the built-in ones, so they will talk about letters not being filled in or matching.

License

This code is licensed under the terms of the BSD 3-Clause License. SMF code used in this mod is copyright Simple Machines.

Portions code is copyright Michael Johnson (motokochan) based on reCAPTCHA for SMF https://custom.simplemachines.org/mods/index.php?mod=1044

Acknowledgements

"SMF" and "Simple Machines" are trademarks of Simple Machines.

Version History

See CHANGELOG

Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Shambles

Hmm... not sure I like the sound of this.

QuoteWhen you use hCaptcha, companies bid on the work your users do as they prove their humanity.

Sounds like you'll be helping to train bots  ???  Change my mind.

vbgamer45

It's the same thing reCaptcha. The ocr technology,photos people are the labor for free.
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

-Rock Lee-

It seems interesting it would be a matter of proving that works, great job @vbgamer45!


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

shadav

well....
I was going to try this, as I can not use smf's built in captcha, nor recapthca
(I don't have a clue what messed those up...too many mods)

but.....
when I go to try and sign up for keys....
it seems it's not working on their site  :o
everytime I click submit get error of please complete the form
oopssss

vbgamer45

Strange. Do you have a different email than normal? If not I would contact them on contact us.
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

shadav

nope, was using yahoo....
i sent them an email to their support...
hopefully they fix it

Arantor

Yahoo is a truly horrible provider to get email to.
Holder of controversial views, all of which my own.


shadav

Quote from: Arantor on April 27, 2020, 11:17:34 AM
Yahoo is a truly horrible provider to get email to.
:laugh: yeah well....been using it for 20 some odd years....stuck with it til it dies  :laugh:

SilverKnight

Thank you for this mod, this should be added to SMF in general these days, built in captcha is useless against today's A.I.

vbgamer45

Update!

Version 2.0
+Adds support for SMF 2.1!
!Fixed bug in SMF 2.0.x with questions and answers.
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Shades.

Just installed on 2.0.18 and cant get the built in image verification to work with this. All that shows is ":" under the hcaptcha.

Image below shows the contact page mod but it does the same on the registration page too.
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

vbgamer45

Do you have any questions and answers? for verification?
What do you have on the settings for registration
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Shades.

Quote from: vbgamer45 on December 10, 2021, 10:26:03 AMDo you have any questions and answers? for verification?
What do you have on the settings for registration
No questions & answers was just trying to use the built in image verification with hcaptcha too.

Here is my registration settings and Anti-Spam settings:
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

vbgamer45

Try changing the visual verifaction option to none and see if it helps
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Shades.

Yes I have done that and the ":" disappears but my question is, why won't they work together (with both checked as on)? Or was it intended to work with both on or just one or the other? ???  O:)

Just asking cause it says "hCaptcha settings are below. If you don't want the built-in image verification, you must set it to none." So that's telling me I can use both at same time optionally. ;)

Also I just now tested and it works with the questions but not with the verification image. ;)
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

vbgamer45

This mod should be one or the other basically hcaptcha replaces image verification option
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Shades.

I just installed a fresh copy of 2.0.18 with no mods except this one and still not working properly. I see the following errors in admin:

QuoteGuest
Type of error: Undefined
https://*****.com/index.php?action=registerApply
8: Undefined offset: 1
File: /home2/*****/public_html/*****/Themes/default/GenericControls.template.php (registration_form sub template - eval?)
Line: 353

Also Line 352 same error message

On the registration page it shows the hcaptcha, the question & answer box, and a ":" with a box under it but no image verification.
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

vbgamer45

And image verification is set to none?
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Shades.

No all are turned on...it works with the image verification off but I thought its all supposed to work on together?
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

vbgamer45

It is either one or the other. basiclly the same as the recaptcha mod i used that as the base
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Shades.

Quote from: Shades. on December 10, 2021, 10:50:24 AMJust asking cause it says "hCaptcha settings are below. If you don't want the built-in image verification, you must set it to none." So that's telling me I can use both at same time optionally. ;)
Ok sorry about that, I misunderstood lol! ;D

But as a suggestion this part here might need to be changed to "hCaptcha settings are below. You Must turn off the built-in image verification by setting it to "None" in order to use hCaptcha."

Or something like that lol! ;)  ;D

Just my two senses worth :laugh:  O:)
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

vbgamer45

Update

Version 2.1
!Updated to new javascript url for the api
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Shades.

Quote from: vbgamer45 on April 14, 2020, 11:12:56 AM[url="https://custom.simplemachines.org/index.php?mod=4255"]Link to the mod[/url]
hCaptcha for SMF
Your link to the mod is messed up on first page https://www.simplemachines.org/community/index.php?topic=572713.msg4051935#msg4051935 ;)
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

vbgamer45

Strange fixed just reedited the mod page.
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Diego Andrés

It's a known bug, it's logged internally  :)

SMF Tricks - Free & Premium Responsive Themes for SMF.

Butiks

Great mod!
Thanks vbgamer45

Please add the necessary functions of the captcha, enable it so that it can be optionally on separate pages:
../index.php?action=login (authorization popup window too)
../index.php?action=reminder - restore account access
../index.php?action=admin - adminpanel
../index.php?action=signup - registration
../index.php?action=search - standard search
../index.php?action=search2 - search from the top search form
../index.php?action=mlist - list of users
../index.php?action=post; - creating a topic on the forum and sending posts in topics
/index.php?action=pm;sa=send - page for sending private message
SMF: 2.1.3
Mods: Optimus, Hide Content, Quick Spoiler, Avatars Display Integration, Similar Topics, Simple Colorizer

vbgamer45

It should on any page that the standard SMF captcha is used.
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

hatmak

I installed this mod but the recaptcha looks the same, it didn't change and I got the error message shown below.


C:/..../Themes/default/GenericControls.template.php (Line 221)
Backtrace information

Type of error: Undefined
Error message Select
2: Undefined array key "can_hcaptcha"

What can i do?

vbgamer45

Disable recaptcha or remove that mod it's either one or the other.
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Louis

To get rid of that "undefined array key" error without completely uninstalling the hCaptcha mod it should be sufficient to add in Subs-Editor.php
'can_hcaptcha' => !empty($modSettings['hcaptcha_enabled']) && !empty($modSettings['hcaptcha_site_key']) && !empty($modSettings['hcaptcha_secret_key']),after
'can_recaptcha' => !empty($modSettings['recaptcha_enabled']) && !empty($modSettings['recaptcha_site_key']) && !empty($modSettings['recaptcha_secret_key']),
Or am I wrong?
It is your mind that creates this world (Buddha)

vbgamer45

Close but there are somethings that need to be changed
We use hcaptcha_private_key and hcaptcha_public_key.
Will push in a mod update for SMF 2.1.x
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

vbgamer45

Update 2.1.1
!Fixed undefined array for SMF 2.1.x
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

riou

Noticed that this mod doesn't seem to play well with the Questions and Answers required (it wasn't showing the proper count), playing with it, it seems the can_hcaptcha was missed from this line?

GenericControls.template
$qIndex = $verify_context['show_visual'] || $verify_context['can_recaptcha'] ? $i - 1 : $i;

Changing it to
$qIndex = $verify_context['show_visual'] || $verify_context['can_recaptcha'] || $verify_context['can_hcaptcha'] ? $i - 1 : $i;
Seems to have gotten the Questions working

This is on SMF 2.1.4

vbgamer45

Thanks have updated the mod!

2.2
!Fixed some bugs if questions and answers is enabled as well.
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

vbgamer45

Version 3.0
!Fix some language strings on verification failure to be better thanks to @MobileCS
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

4LP3RUZ1

Not sure if this is a bug or something wrong with my installation.

Installed, got many errors and could not see the captcha divider:

QuoteUndefined index: use_hcaptcha

Then manually changed those to "can_hcaptcha"

Now it works!?
Frozen frogs are back :(

vbgamer45

Quote from: 4LP3RUZ1 on April 27, 2025, 04:14:45 AMNot sure if this is a bug or something wrong with my installation.

Installed, got many errors and could not see the captcha divider:

QuoteUndefined index: use_hcaptcha

Then manually changed those to "can_hcaptcha"

Now it works!?
Thanks for the report have fixed! And post new version
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Advertisement: