MODx (Revolution) - using CAPTCHA extra for forms - forms

I have installed CAPTCHA extra on MODx Revolution. According to its description
"The Captcha components can also be used by other components to create captcha-style verification for front-end forms."
When changing captcha.enabled in System setting to Yes, it adds Captcha to manager login, but there's no documentation on how to use it on other components, neither I could find any example by googling.
How can I use the Captcha on a desired form? (and not on manager login if possible)
Thanks for your time.

You add it somewhere in your form where you want it to appear:
<img src="[[++assets_url]]components/captcha/captcha.php" alt="Captcha Image" />
And create a textfield for user to enter the result. Then wherever you're doing the validation for your form, compare the value of the textfield to $_SESSION['veriword'].
You can also read this: http://bobsguides.com/captcha-plugin.html

The docs are limited - but there, in the docs folder of the distribution:
Modx Captcha Utility
====================
Author: BobRay <bobray#softville.com>
Date: 08/10/2008
Updated:10/03/2010
====================
This utility provides captcha verification in the MODx
Manager login and elsewhere.
It uses the following System Settings:
captcha.enabled If set, captcha is used for Manager login (off when installed)
captcha.use_mathstring If set, the image is a simple equation for the user to solve (on when installed)
captcha.words Selection of words used for the image if captcha_use_mathstring is off
captcha.height Height of image (default: 80)
captcha.width Width of image (default: 200)
captcha.words Words to use in CAPTCHA challenge
You may add or delete fonts from the core/components/captcha/fonts directory
as long as there is at least one .ttf file there.
You may add or delete images from the core/components/captcha/noise directory
as long as there is at least one file there.
Captcha can also be used in other forms that require captcha.
You can roll your own function by calling assets/components/captcha/captcha.php where you want the image
and then comparing the user's input to the $_SESSION['veriword'] variable.
See the code in the core/components/captcha/captcha.plugin.php file.
You should also be able to see this from the properties of the installed package in the package manager.
Basically, what he is saying that you ~can~ use it for other forms 'if you want to write a little bit of code'

Related

Can't extend Keycloak.v2 theme's AccountPage.js

I was following the Keycloak documentation on adding custom user attributes:
https://www.keycloak.org/docs/latest/server_development/#_custom_user_attributes
I successfully updated the registration form to collect new attributes. I then went on to update the account page, but noticed I had been using the keycloak.v2 theme, so thought I would try extending that instead.
I know my theme is being applied correctly, because I used the theme.properties to set a new logo and favicon and they are appearing correctly:
parent=keycloak.v2
logo=/public/my-logo.svg
logoUrl=./
favIcon=/public/my-icon.ico
However, none of the changes I make to extend the AccountPage.js file seem to be taking effect.
My simple test change:
First I copied the existing AccountPage.js file in the keycloak.v2 folder and placed it in my theme in the same location:
/home/ubuntu/keycloak/keycloak-15.0.2/themes/keycloak.v2/account/resources/content/account-page/AccountPage.js
/home/ubuntu/keycloak/keycloak-15.0.2/themes/mytheme /account/resources/content/account-page/AccountPage.js
Then all I did was change the last name label in the file:
from:
label: Msg.localize('lastName'),
to:
label: "Laaaaaast Name",
and after turning off the caches, and restarting the server and reloading the page in a fresh browser I still see "Last Name" next to the last name input.
I feel like I'm misunderstanding something about the way keycloak layers the files when extending.
What do I need to do in order to see updates I make to the AccountPage.js?

TYPO3 - Blocked loadin mixed active content in console

On my live site 'mysite.com' I see the following error message in the console:
Blocked loading mixed active content “dev.mysite.com/fileadmin/templates/fonts/glyphicons-halflings-regular.woff2”
[Learn More]
jquery-1.11.3.min.js:4:24860
Blocked loading mixed active content “dev.mysite.com/fileadmin/templates/fonts/fontawesome-webfont.woff2?v=4.7.0”
[Learn More]
jquery-1.11.3.min.js:4:24860
I have no clue how it got there and don't remember what I changed. Where do I need to look for and how can I fix this?
I do have a Development Site ... dev.mysite.com ... and for deployment I just move the new files into the live folder.
Edit: I want to fix this problem by loading the files from my live site ... but I don't know from where I'm loading those files.
As those font-files are probably loaded from CSS I assume you already load your CSS from the dev server.
Check this out in the your browser (Network-tab).
You might see it in the HTML source. But the loading also could be initiated by javascript. so you need to check that too for any references to your dev-server.
Then you need to identify the source of this inclusion. If it's in the javascript it's obvious.
The CSS includes can be initiated in multiple places. The most common are in typoscript, so first try: go to the Template Analyzer and look for your dev-server domain. Identify the template and modify it.

In TYPO3 6.x, how to get defaultJS, when config.disableAllHeaderCode is enabled?

I set config.disableAllHeaderCode = 1 in my recent TYPO3 sites, as I want full control over the page template.
But this not only throws out the html tag etc., but also the default Js (which could be used to uncrypt mailto-Links.
One solution would be to copy this TYPO3-generated JS from the core code and insert it manually. Very simple: just set config.disableAllHeaderCode = 0, load the page once, copy the js, done. But, in case of an update or settings change, this might break.
So: is it possible to access this "default JS" via typoscript and assign it to the PAGE object?
Have a look at https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/frontend/Classes/Page/PageGenerator.php. You will see that the spam protection code is hardcoded and only added to the page output if config.disableAllHeaderCode is not set.
Therefore I don't see a possibility to do that. Therefore the answer seems to be no, unless you XCLASS the PageGenerator. I would just copy the JavaScript code; I'm using TYPO3 for some years now and wouldn't remember that the spam protection code ever changed.
There is a solution I think. Go to /typo3/sysext/cms/tslib/templates. There is a file tslib_page_frontend.html. This file is responsible for rendering the whole page including the head. You can define a new path to the above mentioned file. For example set the following code:
config.pageRendererTemplateFile = PATH_TO_YOUR_THEME//Resources/Private/Core/tslib_page_frontend.html
respectively
page.config.pageRendererTemplateFile = PATH_TO_YOUR_THEME//Resources/Private/Core/tslib_page_frontend.html
The new template file can look like the following small snippet:
###JS_INLINE###
###BODY###
That way the inline JS is still rendered (and I think the spam protections JS is inline JS - which can be stored in external files).

disabled javascript in content type form: no javascript

I have a problem in my drupal installation..in the content type page i can't drag and drop lines and i see two columns :weight and parent :image1
The problem had application on the content add form like that: image2
If there any configuration to add or to remove or any help to provide i will be very grateful
Thanks
Sorry..
It seemed to be a server configuration problem.. i uploaded a 'virgin' drupal installation to my remote server ( the producton erver) and i installed without any supplement module, just the core modules with the 777 permission for all the files..but the same problem persist ..I'm suspecting the php version that i' m using (5.2.17 instead of 5.3.10)

TYPO3 - how to set the <base> tag in the header of generated html pages?

I have inherited ownership of a website running on TYPO3 version 4.2.1. There are two pages that are not rendering correctly, and this seems to be down to a failure to load css and javascript files. Inspecting the page source, I can see that the <base href="blah..." /> tag is missing from the page header.
The question: how on Earth do I set the base url property in TYPO3!?
I have poured over the Typo3 website, edited various "typoscript" files, offered sacrafices to the PHP gods, all to no avail. The generated code still does not include the tag.
Any help appreciated. Please note it is not possible for me to "upgrade to the latest version", and my PHP knowledge is non-existant.
Adding this line to the "Setup" field of your site's main TypoScript template ought to do it:
config.baseURL = < URL here >
The "TSRef" (TypoScript Reference) is a key document for every TYPO3 site administrator -- it's available online here:
http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/current/
I recommend printing out a copy to keep at your desk, you will be referring to it frequently. (They provide it in OpenOffice format as well, to make this easy.)
Section 1.6 ("Setup") describes all the properties you can set via TypoScript's CONFIG object:
http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/4.3.0/view/1/6/#id2512147
P.S. While I wasn't going to recommend you download the latest version to fix this problem, I will recommend you download the latest version to be sure you haven't missed any security patches.
Here is how to set the baseurl within the v4.5 introduction package:
Template > Home > Edit Whole Template Record
Includes (between Options and Recources tab )
Click on the little template icon to the left of ROOT, choose Edit
Under Constants > Config, enter the base domain as shown below (leave out the <>
Rememember to clear all cache and then to Ctrl + F5 to complete refresh the browser
TS:
config {
# cat=config; type=boolean; label=Admin Panel: Turn on admin panel (mainly for testing purposes only)
adminPanel = 0
# cat=config; type=boolean; label=Debugging: Turn on debugging (testing purposes only)
debug = 0
# cat=config; type=string; label=Domain name for Base URL: (excluding slashes and protocol like http://)
domain = < ENTER YOUR DOMAIN HERE >
}