Closed (fixed)
Project:
Two-factor Authentication (TFA)
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Dec 2017 at 13:49 UTC
Updated:
9 Oct 2019 at 12:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
manuel garcia commentedComment #3
manuel garcia commentedComment #5
manuel garcia commentedComment #6
daggerhart commentedThanks for the work! I needed to make a minor adjustment. The destination needed to be passed into the url parameters rather than the url "options".
Note: as-written, this will also add a destination when using the normal login form. The destination will be /user/login, and this doesn't cause any problems with logging, but I thought it was worth mentioning.
Comment #7
therealssj commentedTested against the latest branch.
This would be a nice change to have in the next release. Lets get this in!
Comment #8
daggerhart commentedAfter some discussion in slack, @therealssj and I thought it better to have this patch not change the outcome of where the user ends up after logging in using the normal login form at /user/login.
This patch ignores the destination if it is set to /user/login. Feedback welcome.
Comment #9
manuel garcia commentedre #6: good catch!
re #8: Not highly opinionated about this, but isn’t it vanilla Drupal behaviour to send the user to their user page if logging in from the /user/login page without any destinations? If we alter that behaviour, site's that are used to it will definitely notice this change, and may want to correct this.
Comment #10
daggerhart commented@manuel-garcia you're right, thanks! I just tested a vanilla Drupal login and landed on the user/1 page. Here is the patch re-rolled against 8.x-1.x (some line numbers changed) without the special case for /user/login.
Comment #11
daggerhart commentedUpdated the patch to use dependency injection for the redirect.destination and request services.
Comment #12
manuel garcia commentedRe #11: we're only using those in one place but oh well, works for me!
Back to RTBC then.
Comment #13
benjifisher@Manuel Garcia:
I requested the DI on Slack. I think that will make this login block easier to test, which is more important than how many times the objects are used.
Testing
Before applying the patch, I enabled the TFA Login block and tested with two users:
In both cases, the current page reloads after submitting the form.
After applying the patch,
In both cases, the current page reloads after submitting the form.
Code review
1. There is a mismatch. We want a
RequestStackobject, not aRequest:Please update the description as well as the type.
2. Just a suggestion, you can leave this as is if you want.
I think this version will work exactly the same, and is a little easier to read:
Comment #14
benjifisherAs we discussed on Slack, my first requested change was off the mark, but it would be more consistent to call
getCurrentRequest()in thecreate()method.Comment #15
daggerhart commentedThanks @benjifisher, I really appreciate the specific code suggestions.
1. As discussed on slack, I've modified the create() method to return the request from the request_stack.
2. I agree this is more clean. The new patch does what you suggest.
Comment #16
benjifisherI re-tested and reviewed the changes. Looks good!
I am attaching an interdiff comparing the two patches that I reviewed.
Comment #17
manuel garcia commentedpatch looking beautiful, great work guys! rtbc++
Comment #19
nerdsteinThe patch in 15 looks great. Merging!
Comment #21
ginovski commentedIs this fixed currently?
I set up a GA Login plugin and still not getting redirected to the entry form, but instead to the homepage and not logged in.
Maybe I am missing some step in the setup, any hints?