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.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 1342262-bad-ajax.patch | 2.25 KB | david_garcia |
| #2 | logintoboggan.unifiedlogin.js_.patch | 3.53 KB | david_garcia |
Comments
Comment #1
david_garcia commentedProblem also reported in:
https://drupal.org/node/1994650/edit
Comment #2
david_garcia commentedSolved! 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.
Comment #3
Anonymous (not verified) commentedThanks 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.
Comment #4
david_garcia commentedMy 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.
Comment #5
david_garcia commentedTested, reviewed and rolled against latest dev.
Comment #6
Anonymous (not verified) commentedWorks quite well so far... at least no reports of trouble yet.
Comment #7
dooug commentedExperiencing 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++
Comment #8
dooug commentedThis 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.
Comment #10
dooug commentedThanks for the patch, @david_garcia!