Skip to Content Skip to Menu

[SOLVED] CB Spam error on new joomla 4

  • activha
  • activha
  • OFFLINE
  • Posts: 2326
  • Thanks: 117
  • Karma: 13
1 year 10 months ago - 1 year 10 months ago #331934 by activha
Hi

I have a js error on the registration page which is :
Uncaught SyntaxError: redeclaration of const updateFormToken

CB Captcha does not display then at first load and it is needed to click on it to display the code.

This is a new error on joomla 4 that we did not have on j3

You can look at  activ-ha.com/inscription to check

Thanks for your suggestions
Jean
Last edit: 1 year 10 months ago by krileon. Reason: Added [SOLVED] tag to subject

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48419
  • Thanks: 8274
  • Karma: 1443
1 year 10 months ago #331935 by krileon
Replied by krileon on topic CB Spam error on new joomla 4
It's not CB AntiSpam doing this. Something on your site is injecting the following JS anywhere Joomla CSRF token is used and there's more than 1 CSRF token on that page, which is fine but not so fine with whatever is injecting this JS.
Code:
<script>const updateFormToken=async()=>{const response=await fetch('index.php?option=com_ajax&format=json&plugin=getformtoken');if(response.ok){const jsonValue=await response.json();return Promise.resolve(jsonValue);}} updateFormToken().then(data=>{const regex=new RegExp('[0-9a-f]{32}');for(let formToken of document.querySelectorAll('input[type=hidden]')){if(formToken.value=='1'&&regex.test(formToken.name)){formToken.name=data.data[0];}}});</script>

This code doesn't exist anywhere in Joomla 4 core or CB so I assume it's something you've installed doing it.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • activha
  • activha
  • OFFLINE
  • Posts: 2326
  • Thanks: 117
  • Karma: 13
1 year 10 months ago #331937 by activha
Replied by activha on topic CB Spam error on new joomla 4
Oupsss sorry that was an old cache from JCH Optimize added to the page I don't know why...

Probably something remaining from Joomla 3

Solved, thanks for the tip
The following user(s) said Thank You: krileon

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum