Hi,

I am developer of Ajax Register module. Some time ago I got an issue #1637368: Existing user can't login if changes occur with Legal module. After code review I found a bug: in legal_user_login() you should change drupal_goto() function to $edit['redirect']. It provides more carefully redirect for forms processed via ajax. This do not breaks any behavior but expands existing one. Patch attached.

Comments

Sk1Zy’s picture

After applying this patch the error message doesn't pop up and i get a "Login successful" window and then a redirect. However once the page has reloaded the user isn't logged in.

David Stosik’s picture

Status: Needs review » Needs work

Does not work for me either...

spleshka’s picture

Did you apply it to the dev release?

Asome’s picture

same thing, once the page has reloaded the user isn't logged in.

with both versions, dev and not dev

geerlingguy’s picture

Note: It might be better to override $_GET['destination'] inside hook_user_login(); I haven't had much luck with $edit['redirect'].

jarrodirwin’s picture

I am using the legal module in conjunction with ajax_register and neither the $edit['redirect'] or $_GET['destination'] solutions mentioned here have worked for me either.

More information (but not yet a real solution) can be found https://drupal.org/node/1651226

id.tarzanych’s picture

Version: 7.x-1.x-dev » 7.x-1.5
Issue summary: View changes
StatusFileSize
new479 bytes

I am using Fancy login on the site, and this solution have worked for me.

id.tarzanych’s picture

StatusFileSize
new788 bytes

Updated patch, added destination to the link and fixed one-time-login redirect

id.tarzanych’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 8: 1644018-legal-redirect_drupal_goto_fix_with_query.patch, failed testing.

ad4m’s picture

Status: Needs work » Needs review
StatusFileSize
new675 bytes

Hi,

I've encountered same issue when loging in users using ajax and legal had changed. Patch provided by @Spleshka worked for me, but I think it's not enough. Since legal module destroys user session, it must also set $form_state['uid'] = 0; to let other module know that log in actually did not happen.

I'm uploading a patch.

Status: Needs review » Needs work

The last submitted patch, 11: legal-Fix_redirec_on_hook_user_login-1644018-11.patch, failed testing.

zeezhao’s picture

Using fancy_login and patches in #8 and #11 above don't work for me i.e. user can't login when change to legal module. So user is not redirected to legal module to confirm change. Please has anyone got a fix for this? Thanks.

tasc’s picture

#8 works for me with asaf & autodialog modules.

Dorayaki’s picture

For those who still unable to be redirected could try this solution:

Replace:
drupal_goto('legal_accept/' . $signatory->uid . '/' . md5($signatory->name . $signatory->pass . $signatory->login), array('query' => $query));
to:
$GLOBALS['destination'] = 'legal_accept/'. $signatory->uid . '/' . md5($signatory->name . $signatory->pass . $signatory->login);

ad4m’s picture

Version: 7.x-1.5 » 7.x-1.10
Status: Needs work » Needs review
StatusFileSize
new468 bytes

4 years later, module update and issues is still there... Here is patch updated to version 1.10.

Status: Needs review » Needs work
akkina’s picture

I reformatted #16's patch and will attache it here.

web226’s picture

Thanks, the patch in #18 worked for me on Legal 7.x1.10

zhinio’s picture

Hi,
I am using Bootstrap Login Modal and patch #18 didn't work for me. This is an awesome module and it would be nice if there is a solution for the modal logins.

avpaderno’s picture

Version: 7.x-1.10 » 7.x-1.x-dev

Bugs are fixed in the development snapshot.

avpaderno’s picture

Status: Needs work » Needs review