The attach function in Drupal.behaviors.unifiedLogin (file "logintoboggan.unifiedlogin.js") gets called when the document/page gets called originally and again every time when the page makes an Ajax call. That can cause problems in the way the Drupal.behaviors.unifiedLogin is currently designed:

1) The events get assigned more than once (which doesn't really matter, unless it fills up the events memory of the browser if that hapens too often)

2) One of the click() event in the switch clause at the end of Drupal.behaviors.unifiedLogin get executed after each Ajax call and that can cause "funny" effects: We call the page /user and the user has no account yet so he switches over to the registration form. If there is a Ajax call (e.g. from a loop), then the form suddenly switches back to the login part of the form and the user gets lost.

I think the whole method should be modified so that it's only called once or by adding a class to the nodes after the first execution so that we know next time, that they won't get executed again.

Comments

david_garcia’s picture

Issue summary: View changes

Problem also reported in:

https://drupal.org/node/1994650/edit

david_garcia’s picture

Status: Active » Needs work
StatusFileSize
new3.53 KB

Solved! Patch attached in non GIT format. Sorry but I am running forked version of the module that has also integrated password recovery page.

This looks like it was straight ported from D6, and not using what D7 had to offer:

- Use context when applying selectors
- Use settings passed to attach, not global Drupal.settings

That should had been enought, but just to make sure no duplicates happen, use: ":not(.processed)" in selectors.

Anonymous’s picture

Thanks for the work on this, I haven't had time to do a fix on my sites yet.

I tried to use the patch but I'm running on the stable branch so the patch fails. I don't have time to do a re-roll at the moment so just letting you know. I don't want to roll out the dev version on a whim without extensive testing first.

david_garcia’s picture

My patch won't even work against dev...it was rolled against custom version.

Yet, I provide it to help other people to solve the issue, the patch is easy to understand and apply.

david_garcia’s picture

Status: Needs work » Needs review
StatusFileSize
new2.25 KB

Tested, reviewed and rolled against latest dev.

Anonymous’s picture

Works quite well so far... at least no reports of trouble yet.

dooug’s picture

Issue summary: View changes

Experiencing an issue with Mollom captcha's on the unified login toboggan page: When switching between the image & audio CAPTCHA on the user register form, the page would reload and show the login tab.

I applied the patch from comment #5 to logintoboggan 7.x-1.x-dev. This resolved the bug mentioned above. It also properly uses AJAX to change the CAPTCHA type without reloading the page.

The patch looks like good code following best practices. Thanks for the patch! RTBC++

dooug’s picture

Assigned: Unassigned » dooug
Status: Needs review » Reviewed & tested by the community

This has been working well for me for 6+ months on a large client site. The patch improves the code to follow best practices. I'll get this committed.

  • dooug committed 92765c2 on 7.x-1.x authored by david_garcia
    Issue #1342262 by david_garcia: Fixes Drupal.behaviors.unifiedLogin...
dooug’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the patch, @david_garcia!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.