Am running
- Drupal 6.16 on Ubuntu Hardy Heron.
- PHP Version 5.2.4-2ubuntu5.10
Login is being accommodated via
Ajax module and
- Ajax Login/Register module(v6.x-1.5) with
- Ajax plugin-thickbox(v6.x-1.x-dev).
Scenario:
- User clicks on Login link.
- Login form is manifest inside a thickbox modal.
- User enters username and Password and clicks a Log in button.
- Small error box results with message "ajax.module : An unknown error has occurred"
- Thickbox login modal remains open with Log in button stuck on Loading
- However, user is logged in. They have to Close the modal and click on the Drupal header image or a link - then Drupal shows them as authenticated.
- If they do not close this modal and click on a link, the login modal never closes and they are never redirected to their My Account User page owing to the unknown error.
- Nothing besides user session opened reported as a notice in Drupal Recent log entries
- Nothing reported in Apache log
Would really appreciate some Drupal guidance on this as I have to present this application to a review committee on Friday May 7th and do not want to revert to non-ajax user module login web form as the newly created theme does not facilitate this nicely.
Let me know if you need any other information - I've spent a few days swapping in and out various versions of ajax(6.x-1.14 and 6.x-1.x-dev) and ajax_register modules(6.x-1.5, 6.x-2.1, 6.x-2.x-dev) in an effort to circumvent...all to no avail...same error results.
Everything else is working beautifully except this and its the first piece of functionality I have to demonstrate so its sort of vital I get it working.
Thanks in advance to any/all
R
Comments
Comment #1
resmonde commentedUgh, that sinking feeling, I must be the only one seeing this. I have so far had no success in getting to the root cause despite days of staring and turning modules on and off and swapping ajax versions. For the sakes of a workaround(Hack) I am doing the following.. maybe it'll help someone else get around this issue :
- Edit ajax.js inside; yourdrupalsite_directory_name/sites/all/modules/ajax/
- Circa line 107.. where the JS alert is being produced by a JSON post/response
- Comment out the alert, Remove the modal, direct user to where you want them to land post login:
// window.alert(Drupal.t('ajax.module: An unknown error has occurred.'));
tb_remove;
location.href = 'http://mydrupalsite/user/';
- Don't forget to add comments so you can remember what you did, where you did it and most importantly why you did it!
Comment #2
resmonde commentedJust downgrading the priority of this as my hack appears to circumvent it. It might be some form of bug but I'll let more knowledgeable Drupal-Heads make that determination as everyone's install has different modules and permission sets and maybe some weird permutation of what I have installed and enabled is causing it.
Comment #3
ekizai commentedI have same problem this is work thank you very much
Comment #4
julianmancera commentedIt seems to be related with the way json object is parsed I found this http://drupal.org/node/792988 in the comunity.
Comment #5
rsrkrishna commentedthanks,
it worked for me too :)
Comment #6
Rizhaya commentedI have similar problem with login page, but the "Unknown error" happens only when the login or password is wrong. The #1 didn't help.
Comment #7
dedisoft commentedI have the same problem since I activated the Secured page module.
If I logs on Drupal with HTTP url (without SSL), I've got this error.
But if I logs on Drupal using HTTPS (on the Url -> https://www.mydomain.ext/user), I didn't get the error and i can log on successfully.
If this information can help you...
Comment #8
nagrgk commentedGuys , i understood where exactly this error is loading from. The ajax error due to parsing error. The function of form_set_ error is working with jquery 1.3 ver .Its doesnot support laest versions .So, W e need o add json_decode function in inc.php which will solve ajax login/register error. If you have more questions , reply on same
Comment #9
caspercash commentedCould you elaborate more on how to workaround this problem nagrgk? I think the community will really appreciate it. Thanks!
Comment #10
caspercash commentedHas anybody come up with a workaround on this error without touching the ajax.js?
Comment #11
nagrgk commentedfunction drupal_to_js($var) {
switch (gettype($var)) {
case 'boolean':
return $var ? 'true' : 'false'; // Lowercase necessary!
case 'integer':
case 'double':
return $var;
case 'resource':
case 'string':
/*return '"'. str_replace(array("\r", "\n", "<", ">", "&"),
array('\r', '\n', '\x3c', '\x3e', '\x26'),
addslashes($var)) .'"';*/
return json_encode($var);
includes common.inc and try to replace jquery 1.3 with 1.7