When the OpenID login link is clicked, the expected result is for the username and password fields to be hidden, and the openid field to appear.
However, if the user login block is used on the contact page, instead of hiding the username field in the user login block, the name field is hidden on the contact form.
The cause of this seems to be that the classes and ids for these fields are the same - therefore, the js doesn't know which one to pick (or picks the one that appears first in the page).
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | openid-js-6.patch | 3.9 KB | c960657 |
| #7 | openid-js-5.patch | 2.91 KB | c960657 |
| #6 | openid-js-4.patch | 2.85 KB | c960657 |
| #5 | openid-js-4.patch | 2.85 KB | c960657 |
| #4 | openid-js-3.patch | 3.19 KB | c960657 |
Comments
Comment #1
mfbWe should be able to fix this by adding the form ids to the selector.
Comment #2
c960657 commentedThere are other conflicts, e.g.
#edit-name. Here is what I came up with (I did not know that somebody was already working on this).Comment #3
mfbMaybe you could also fix the nearby weird indentation (3 spaces instead of 2)?
Otherwise it looks good to me. I noticed you changed
$('div.messages.error').css('display', 'block');to$('div.messages.error').hide();which I guess is fine, no need to show error messages after these links are clicked.By the way, while testing the contact page I noticed that the contact edit-name input gets the error class when login fails, and likewise login edit-name input gets error class when contact name is left blank. This looks like a regression in form API with error being set for all forms on the page, I will file an issue on that if I don't find one that already exists.
Comment #4
c960657 commentedThis fixes the weird 3 indentation too.
Comment #5
c960657 commentedComment #6
c960657 commentedComment #7
c960657 commentedReroll due to #22336: Move all core Drupal files under a /core folder to improve usability and upgrades.
Comment #8
sunOverall, it looks like we're missing a $.once() here...? (as in all other Drupal behaviors - otherwise, this behavior is executed multiple times when behaviors are re-run on the existing page)
1) It would make much more sense to me if openid.module would apply a .openid-form CSS class to the forms it enhances. Based on that, this behavior would be way more robust:
This looks like a typical detach behavior method to me.
9 days to next Drupal core point release.
Comment #9
c960657 commentedThank you for good review comments.
Similar logic is implemented via .openid-processed. I have updated it to use once() instead.
Good point. Done.
I'm not sure what you mean. Something like this?
Comment #10
bfroehle commentedIt'd be nice to agree on a common solution here, as #1395612: Conflict with core contact form in the CAS module is waiting on the outcome of this issue.
Comment #11
c960657 commentedA fix for this issue is included in the patch for #1538462: Cannot log in with OpenID due to "required" attribute.
Comment #12
c960657 commentedFixed together with #1538462.