It seems there's no CAPTCHA test on account register form when LoginToboggan option "Present a unified login/registration page" is on. I can see the CAPTCHA test when I first load the login page on the default tab (login one). When selecting the "I want to create an account" tab I only got the register form with no CAPTCHA test on.

Comments

fluffy’s picture

reporting the same problem, the FB module disables CAPTCHA for registration

cesareaugusto’s picture

I got no FB module on but still not CAPTCHA...

JoshuaF’s picture

I had same problem.

I had to disable Unified Login in the LoginToboggan and the Captcha/ReCaptcha showed up normally.

cdrop’s picture

Any progress here?

spirodon’s picture

I have a fix but it's purely JS based and very specific to the problem I was encountering. Also, it was a dirty fix, it would be better to override the prototype or some similar, cleaner way of doing this, but hopefully you get the point.

When using the unified login, there are (of course) two forms, and some of the fields have a --2 in their ID attributes to identify themselves as separate forms on the same page. Using those ID's, we can drill down to the specific ReCaptcha field that we want to display and re-initialize ReCaptcha appropriately. ReCaptcha only initializes itself once, although called via Javascript twice, because it's looking for an ID that is the same on both forms (since the ReCaptcha module displays the ReCaptcha fields, not the Logintoboggan form). So my JQuery code finds the second field when you hit the register link using the logintoboggan --2 ID attribute appendage and re-initializes ReCaptcha. Same when going back to the login.

I used a custom module with html_head_alter to add the JS to the specific pages I needed.

(function ($) {
	Drupal.behaviors.unifiedLogin = {
		attach: function (context) {
			// Attach behaviors to the links so that they show/hide forms appropriately.
			$('.toboggan-unified #register-link').click(function() {
				$(this).addClass('lt-active').blur();
				$('.toboggan-unified #login-link').removeClass('lt-active');
				$('.toboggan-unified #register-form').show();
				$('.toboggan-unified #login-form').hide();
				if ($("#edit-captcha-form--2")) {
					$("#edit-captcha-form--2 #recaptcha_ajax_api_container").attr('id', 'recaptcha_ajax_api_container--2');
					Recaptcha.create('6LcNjc0SAAAAAAfM5xmUbt7bwIM1nVh1nrUVEYiK', 'recaptcha_ajax_api_container--2', {theme: 'clean'});
				}
				return false;
			});
			$('.toboggan-unified #login-link').click(function() {
				$(this).addClass('lt-active').blur();
				$('.toboggan-unified #register-link').removeClass('lt-active');
				$('.toboggan-unified #login-form').show();
				$('.toboggan-unified #register-form').hide();
				Recaptcha.create('6LcNjc0SAAAAAAfM5xmUbt7bwIM1nVh1nrUVEYiK', 'recaptcha_ajax_api_container', {theme: 'clean'});
				return false;
			});
			switch(Drupal.settings.LoginToboggan.unifiedLoginActiveForm) {
				case 'register':
					$('.toboggan-unified #register-link').click();
				break;
					case 'login':
				default:
					$('.toboggan-unified #login-link').click();
				break;
			}
		}
	};
})(jQuery);
bassplaya’s picture

kevster’s picture

Quite surprised to find this still an issue or is it fixed in the dev version? Would be good to have a unified captcha across the site but I like the unified login page - especially for mobile users...

zuhair_ak’s picture

This is an issue with recaptcha module and there is a patch for it in the issue queue of the module -
https://www.drupal.org/node/1833822 .

It is still not fixed but the patch provided solves this problem.

drupalmonkey’s picture

The patch at https://www.drupal.org/node/1833822#comment-11430341 for reCAPTCHA worked for me for this issue.