Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have a custom login form submit handler, which runs before the TFA submit handler, and sets a custom $form_state['redirect']
.
TFA appears to want to do something with the redirect, but it actually does nothing. The bug appears to be here:
http://cgit.drupalcode.org/tfa/tree/tfa.module#n284
where $context['redirect']
is set, and then 7 lines later the $context
variable is re-assigned.
But I don't know enough about the module to patch it yet.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2464571-tfa-form-redirect.patch | 3.88 KB | coltrane |
#1 | tfa-2464571-1.patch | 1.25 KB | pjcdawkins |
Comments
Comment #1
pjcdawkins CreditAttribution: pjcdawkins commentedWell, this might work
Comment #2
coltraneGreat find @pjcdawkins. I added a test for this and updated the code comments in the attached patch. Care to review?
I'm curious, in your custom form alter in what position do you set the form submit handler (ie. beginning or end of the array)? Presently tfa_login_form_redirect() needs to be last in the array but I don't have a foolproof way of enforcing that.
Comment #3
pjcdawkins CreditAttribution: pjcdawkins commentedIt's a module whose form_alter happens to run before TFA's (thanks to the alphabet), so its submit handler is added just before TFA's (I confirmed that with some debugging).
Comment #4
nagba CreditAttribution: nagba commentedJust a heads for the time being as I havent had the time yet to check if D7 is similar in this regard but for the D6 version I had to modify the above patch a tad bit:
once i get a bit of breathing room i'll try to follow up on this.
Comment #5
coltrane@nagba I think that in D6 checking REQUEST['destination'] is necessary but in D7 its not. Would love your testing and feedback but I think patch in #2 is looking ready to go.
Comment #6
pjcdawkins CreditAttribution: pjcdawkins commentedRight, in D7 (at least?) the 'destination' should only ever be in $_GET, and the code already unsets that.
Perhaps we should add a test though to cover the case when there is a destination in the URL?
Comment #8
coltraneCommitted.
Re: #6, the testRedirection method sets filter/tips on the URL.