Bad Response form submission on login

frankcarey - May 22, 2009 - 21:39
Project:Popups API (Ajax Dialogs)
Version:6.x-2.0-alpha5
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

First off the popup skins are just plain sexy!

I got the most recent CVS checkout of the 6--2 branch this morning, and I'm still getting this error after signing in using a popup of a the /user link: Bad Response form submission

I tried the following classes:
"popups"
"popups popups-form-reload"

Looking at the code on the page after i login, I see this in firebug.


p class="login-here">

If i type the wrong password, I get the error back and I can retype to correct one, but when it submits sucessfully, I get the error, and the page doesn't reload. If I manually reload I am logged in though, so am I just using the wrong class here?

I have the most recent LogginToboggin installed as well.

Thanks all for a great module!

#1

dboulet - June 7, 2009 - 21:50

Try the code from here.

#2

frankcarey - June 9, 2009 - 01:57

I have tried that code, but i still get the same error. I also tried code using the popups_add_popups, and it has the same effect.

<?php
global $user;

popups_add_popups(
  array(
'.login-links' => array(
    
'reloadOnError' =>'TRUE',
  ))
);

$attrib = array('attributes' => array('class' => 'login-links'));

if (
$user->uid) {
 
$output = l("logout", "logout", $attrib); 
}
else {
 
$output = l("login", 'user', array('attributes' => array('class' => 'login-links', 'query' => array('destination' => $_GET['q']))));
 
$output .= " | ";
 
$output .=l("register", 'user/register', array('attributes' => array('class' => 'popups')));
}
print
$output;
?>

#3

frankcarey - June 9, 2009 - 02:29

OK, further investigation:

1) This is an intermittent problem :(

We are using the code above to generate a login /logout block we have on every page. First I noticed this happening on certain pages and not on others.

Every node page i have found, forums, cck nodes, etc. -> login works, but there is no page reload

Every view -> Login works fine

A panel (have only 1 avail right now) -> get the bad response error, and no page reload

Any ideas?

#4

frankcarey - June 9, 2009 - 02:37

Another panel (totally different content) also gives the Bad response error.

#5

frankcarey - June 9, 2009 - 02:42

links in all are the same

<a class="login-links popups-processed" query="" href="/user" title="[Popup]">login</a>

#6

dboulet - June 9, 2009 - 03:35

There was an error in the code that I linked to in #1, it should be like this:

<?php
print l("login", 'user', array('attributes' => array('class' => 'popups-form-reload'), 'query' => array('destination' => $_GET['q'])));
?>

Notice the closing parenthesis after 'popups-form-reload', without it your link tags have a 'query' attribute.

#7

frankcarey - June 9, 2009 - 16:12

I get this now

<a class="login-links popups-processed" href="/user?destination=signup" title="[Popup]">login</a>

still not functional

#8

frankcarey - June 9, 2009 - 16:16

As per your suggestions I also tried this again:

<a class="popups-form-reload popups-processed" href="/user?destination=signup" title="[Popup]">login</a>

Still same issue. Such an odd issue... for some reason the JS doesn't reload the page when it should.

#9

frankcarey - June 9, 2009 - 16:20

Also tried without the query all together and still get the same bad response form response

<a class="popups-form-reload popups-processed" href="/user" title="[Popup]">login</a>

#10

frankcarey - June 9, 2009 - 16:23

additional comment about #3: On the phone with the client, he was getting the bad response on every page, even the views where i wasn't (and still am not)... very strange.

#11

frankcarey - June 9, 2009 - 16:52
Version:6.x-2.x-dev» 6.x-2.0-alpha5

OK, I decided to just dig into the code an force a page reload. Looking at the code for "Bad form response", it just sets a message in the popup, and nothing else... maybe the form-reload code isn't working right?

I commented out the message and then added a location.reload() to force the page to reload on error, and it seems to be working fine now. I've attached a patch to document what i did, but it probably needs a better look for a more elegant answer?

@ dboulet - thanks for trying to help me.

Also updating the issue for aplha5, since this is the version I'm currently using.

AttachmentSize
popups-bad-response-hack.patch 449 bytes

#12

-Shaman- - August 9, 2009 - 12:51

frankcarey - Thanks for this patch, works as a charm! In my opinion this patch should be ported into dev as popup warning "Bad response form submission" is useless when it comes to normal use of this module.

#13

sirkitree - August 26, 2009 - 21:51

So the problem here is that if you are on /user/login or /user/register and you try to login through a popup, the originalPath variable is set to /user/login or /user/register depending on which page you are on. Popups does a request to this url after form success, but as you are now logged in, you get access denied because you can only access those user pages as anonymous. So when the GET request comes back 404, it errors out, hence Bad form submission error.

What would be desirable here is that it would use the destination param instead and reload to the destination.

#14

bruzed - August 27, 2009 - 22:08

#2 works for me but I get the following error:

warning: preg_match() expects parameter 2 to be string, array given in /path/to/drupal/includes/bootstrap.inc on line 771.

any ideas on how to fix this?

#15

dropchew - November 9, 2009 - 09:22

I tried the patch in #11 and works for normal popups, but breaks for form upon submit, like the avatar upload...Got the bad response form and the picture did not get uploaded...

Edit: sorry posted in wrong thread. Follow here http://drupal.org/node/436094

 
 

Drupal is a registered trademark of Dries Buytaert.