-
Notifications
You must be signed in to change notification settings - Fork 15
fix selection of mode on login #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
When the User selects a mode on the login form (ie. setting horde_select_view), it gets always overwritten by 'auto'. The reason is that during login there is a cycle that leads to authentication being triggered twice. The culprit is the call to setAuth at https://github.com/horde/Core/blob/master/lib/Horde/Core/Auth/Application.php#L669 which ends up triggering a second authentication through $this->loadPrefs($this->getApp()); which in turn does not have access to the original $credentials array and then sets the view to the default value. The fix is to set the view first.
a34eec7
to
b2139cf
Compare
I can't reproduce this. When selecting a specific view from the login screen, it's always honored. I.e., I always see the mobile view, or desktop view as expected. I'm not following what you mean by the original $credentials array is not available in loadPrefs... |
it is been a while since I debugged this, so it is hard to remember all the details. but I can confirm that with the newest released version of horde we still have this issue, when we disable the patch from this PR. the problem is probably related to the authentication method. we are using
the problem as I understand it is: Core/lib/Horde/Core/Auth/Application.php Line 125 in 122f267
now here i am not fully sure anymore, but I believe it was as follows:
at this point |
@mrubinsk is there anything we could provide on our end here? I can confirm that the issue is related to the application auth driver. |
Not really. I need to digest your code path. I'm using the exact same authentication driver(s) and am unable to reproduce. |
Looking at _setView(), the $mode is only overwritten if either force_view is true, or select_view is false. Otherwise $this->_view is used which is set earlier in authenticate(). |
I'll try to understand your comment tomorrow. But I just want to note again that we have since this ticket was opened the patch in this PR applied to our deployment and the mode selection really does not work without it! |
The problem is that But then the call to setAuth internally creates a second This secondary instance beats the first one to call |
And just to tripple confirm again, that this is really what is going on, I logged in with the following patch applied:
i.e. I disable the check if the view is already set and instead always set it. And I log every time it is set. Then I see first 8 'auto' notifications (for each horde app being initialized as described in my initial diagnosis of the issue). And then the final notification is 'dynamic', which correctly sets the view and I am logged in with the correct view. I really don't know what else I can do to convince you the bug is real... |
I have a theory why you can't reproduce it: In our case the normal horde login form is bypassed by a custom SSO mechanism. Thus, normally the horde session is created when the user loads the login form. In our case the horde session is created in the same request as the post to |
That's an important piece of information. Though, ff you use a SSO authentication, how are users selecting the view from the login screen? |
Indeed, I did not realize that it plays a role here. They select the view on a custom form and the SSO then logs them into horde, by relying them to horde's login.php, doing the exact same post request that the horde login form would do. |
When the User selects a mode on the login form (ie. setting horde_select_view),
it gets always overwritten by 'auto'. The reason is that during login there is
a cycle that leads to authentication being triggered twice.
The culprit is the call to setAuth at
https://github.com/horde/Core/blob/master/lib/Horde/Core/Auth/Application.php#L669
which ends up triggering a second authentication through
which in turn does not have access to the original $credentials array and then
sets the view to the default value.
This patch breaks the cycle, by preventing the second auth when the first one
did not finish.