Commit 06cd9f51 authored by Robert Lyon's avatar Robert Lyon Committed by Cecilia Vela Gurovic

Bug 1726560: Add captcha field to contact us form

When the user is logged out

behatnotneeded

Change-Id: Icc8711671f0f73699da79aca4b53548210fb6875
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent ea641a96
...@@ -460,8 +460,8 @@ $siteoptionform = array( ...@@ -460,8 +460,8 @@ $siteoptionform = array(
), ),
'recaptchaonregisterform' => array( 'recaptchaonregisterform' => array(
'type' => 'switchbox', 'type' => 'switchbox',
'title' => get_string('recaptchaonregisterform', 'admin'), 'title' => get_string('recaptchaonregisterform1', 'admin'),
'description' => get_string('recaptchaonregisterformdesc1', 'admin'), 'description' => get_string('recaptchaonregisterformdesc2', 'admin'),
'defaultvalue' => get_config('recaptchaonregisterform'), 'defaultvalue' => get_config('recaptchaonregisterform'),
'help' => true, 'help' => true,
'disabled' => in_array('recaptchaonregisterform', $OVERRIDDEN) 'disabled' => in_array('recaptchaonregisterform', $OVERRIDDEN)
......
...@@ -24,7 +24,7 @@ For good security, consider using a passphrase. A passphrase is a sentence rathe ...@@ -24,7 +24,7 @@ For good security, consider using a passphrase. A passphrase is a sentence rathe
$string['passwordinvalidform'] = 'Your password must be at least six characters long. Passwords are case sensitive and must be different from your username.<br/> $string['passwordinvalidform'] = 'Your password must be at least six characters long. Passwords are case sensitive and must be different from your username.<br/>
For good security, consider using a passphrase. A passphrase is a sentence rather than a single word. Consider using a favourite quote or listing two (or more!) of your favourite things separated by spaces.'; For good security, consider using a passphrase. A passphrase is a sentence rather than a single word. Consider using a favourite quote or listing two (or more!) of your favourite things separated by spaces.';
$string['recaptcharegistertitle'] = 'reCAPTCHA challenge'; $string['recaptcharegistertitle'] = 'reCAPTCHA challenge';
$string['recaptcharegisterdesc'] = 'Please enter the words you see in the box, in order and separated by a space. Doing so helps prevent automated programs from abusing this service.'; $string['recaptcharegisterdesc1'] = 'Please tick the "I\'m not a robot" box. Doing so helps prevent automated programs from abusing this service.';
$string['registeredemailsubject'] = 'You have registered at %s'; $string['registeredemailsubject'] = 'You have registered at %s';
$string['registeredemailmessagetext'] = 'Hi %s, $string['registeredemailmessagetext'] = 'Hi %s,
......
...@@ -63,7 +63,11 @@ $elements = array( ...@@ -63,7 +63,11 @@ $elements = array(
), ),
) )
); );
if (!$USER->is_logged_in()) {
$elements['captcha'] = array(
'type' => 'captcha',
);
}
$elements['userid'] = array( $elements['userid'] = array(
'type' => 'hidden', 'type' => 'hidden',
'value' => $userid, 'value' => $userid,
......
...@@ -401,8 +401,8 @@ $string['licenseallowcustom1'] = 'Custom licenses'; ...@@ -401,8 +401,8 @@ $string['licenseallowcustom1'] = 'Custom licenses';
$string['licenseallowcustomdescription'] = "For license metadata, allow users to enter any URL as the license. If not checked, users will be limited to the licenses configured by the site administrator."; $string['licenseallowcustomdescription'] = "For license metadata, allow users to enter any URL as the license. If not checked, users will be limited to the licenses configured by the site administrator.";
$string['recaptchakeysmissing1'] = 'reCAPTCHA is turned on, but it will not function until you also provide a site key and secret key.'; $string['recaptchakeysmissing1'] = 'reCAPTCHA is turned on, but it will not function until you also provide a site key and secret key.';
$string['recaptchanotpassed'] = 'The reCAPTCHA wasn\'t entered correctly. Please try it again.'; $string['recaptchanotpassed'] = 'The reCAPTCHA wasn\'t entered correctly. Please try it again.';
$string['recaptchaonregisterform'] = 'reCAPTCHA on user registration form'; $string['recaptchaonregisterform1'] = 'reCAPTCHA on user registration/contact us forms';
$string['recaptchaonregisterformdesc1'] = 'Users self-registering a new account will have to prove themselves human by passing a <a href="http://recaptcha.org/">reCAPTCHA</a> test.'; $string['recaptchaonregisterformdesc2'] = 'Users self-registering a new account or using the contact us form will have to prove themselves human by passing a <a href="http://recaptcha.org/">reCAPTCHA</a> test.';
$string['recaptchaprivatekey1'] = 'reCAPTCHA secret key'; $string['recaptchaprivatekey1'] = 'reCAPTCHA secret key';
$string['recaptchaprivatekeydesc1'] = 'The secret key for your site\'s reCAPTCHA account.'; $string['recaptchaprivatekeydesc1'] = 'The secret key for your site\'s reCAPTCHA account.';
$string['recaptchapublickey1'] = 'reCAPTCHA site key'; $string['recaptchapublickey1'] = 'reCAPTCHA site key';
......
...@@ -64,7 +64,7 @@ function pieform_element_captcha_set_attributes($element) { ...@@ -64,7 +64,7 @@ function pieform_element_captcha_set_attributes($element) {
} }
$element['rules']['validate'] = array(); $element['rules']['validate'] = array();
if (empty($element['description'])) { if (empty($element['description'])) {
$element['description'] = get_string('recaptcharegisterdesc', 'auth.internal'); $element['description'] = get_string('recaptcharegisterdesc1', 'auth.internal');
} }
if (empty($element['title'])) { if (empty($element['title'])) {
$element['title'] = get_string('recaptcharegistertitle', 'auth.internal'); $element['title'] = get_string('recaptcharegistertitle', 'auth.internal');
......
...@@ -36,7 +36,7 @@ Scenario: Turning the switches on and off on the Site Options page (Bug 1431569) ...@@ -36,7 +36,7 @@ Scenario: Turning the switches on and off on the Site Options page (Bug 1431569)
| Spamhaus URL blacklist | 1 | | Spamhaus URL blacklist | 1 |
| SURBL URL blacklist | 1 | | SURBL URL blacklist | 1 |
| Disable external resources in user HTML | 1 | | Disable external resources in user HTML | 1 |
| reCAPTCHA on user registration form | 1 | | reCAPTCHA on user registration/contact us forms | 1 |
| Allow public pages | 0 | | Allow public pages | 0 |
| Allow public profiles | 0 | | Allow public profiles | 0 |
| Allow anonymous pages | 1 | | Allow anonymous pages | 1 |
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment