-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
fix remember me login #1347
fix remember me login #1347
Conversation
@ChristophWurst, thanks for your PR! By analyzing the annotation information on this pull request, we identified @LukasReschke, @DeepDiver1975 and @icewind1991 to be potential reviewers |
|
This is where I'll have to check whether the checkbox was checked or not 😉 |
Hi, Maybe you can consider this request as well. Thanks |
The basic remember-me-login works again, but the session token validation logic logs the user out because it cannot find a valid session token in the DB for the current session id on the next request. Solution 1: Re-use old session token Solution 2: Create a new session token I've not come to a clean, robust solution yet. @LukasReschke @MorrisJobke @rullzer @icewind1991 does anybody have an idea how we could fix that in the scope of 10.0.2? |
8fda5ce
to
cfca4c8
Compare
Updated solution 1: Construct a new session token with the data from the old one. That means we'd have to store the session token ID or similar next to the remember me cookie (either additional cookie or combine somehow). When we try to log in by cookie, we first run the old logic (lookup login token in DB). Then we load the old session token from the database, based on the value of the remember me cookie. That old session token will be cloned (create a new one with same attributes, but with the new session ID of course). Future requests should be successfully authenticated again. We can then safely delete the old token. Additional problem: we have to tweak the lifetime of session tokens in the DB because they are currently deleted after 24h of inactivity. @LukasReschke @rullzer @nickvergessen @MorrisJobke objections? I'd try to implement this if you agree that this is the way to go. |
3006121
to
67dfc62
Compare
Current coverage is 57.53% (diff: 59.03%)@@ master #1347 diff @@
==========================================
Files 1078 1078
Lines 61498 62197 +699
Methods 6875 7009 +134
Messages 0 0
Branches 0 0
==========================================
+ Hits 35266 35787 +521
- Misses 26232 26410 +178
Partials 0 0
|
d382a67
to
5cf1039
Compare
9ef22d3
to
21a1aa1
Compare
Fixed and added some tests, squashed my commits and rebased to resolve some conflicts. @LukasReschke @MorrisJobke @rullzer this is ready for testing. I faked a lost session by deleting the session cookie and php's session files. |
@@ -51,6 +52,7 @@ class Manager { | |||
* @param AppManager $appManager | |||
* @param ISession $session | |||
* @param IConfig $config | |||
* @param Session $userSession |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're passing a ISession and not a Session
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it seems like that is even not ever used :)
* try to reuse the old session token for remember me login * decrypt/encrypt token password and set the session id accordingly * create remember-me cookies only if checkbox is checked and 2fa solved * adjust db token cleanup to store remembered tokens longer * adjust unit tests Signed-off-by: Christoph Wurst <[email protected]>
Signed-off-by: Christoph Wurst <[email protected]>
Signed-off-by: Lukas Reschke <[email protected]>
Signed-off-by: Lukas Reschke <[email protected]>
Signed-off-by: Lukas Reschke <[email protected]>
cb5db29
to
9d6e01e
Compare
@LukasReschke anything left? |
#### DO NOT CHANGE ANYTHING ABOVE THIS LINE #### | ||
|
||
ErrorDocument 403 /core/templates/403.php | ||
ErrorDocument 404 /core/templates/404.php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LukasReschke anything left?
Yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
LGTM once the last issue is fixed :) |
Signed-off-by: Christoph Wurst <[email protected]>
8b4e54d
to
4da6b20
Compare
Hello, I'm using NC11 just downloaded yesterday and I want to disable saving the login session cookie. In fact, I want that users get automatically logged out after 10 minutes of inactivity. This works fine: But the "stay logged in" checkbox on the login screen is still visible (although disabled by 'remember_login_cookie_lifetime' => 0 AFAIK). The addon "disable remember login" (from OC) is not available any more in the app store of NC11, so I assume (wrongly?) I shouldn't use it any more with NC11 (was available with NC10). Is there a way to hide the checkbox on the login screen? Following this thread I assumed I have to set a config.php parameter but I don't see which one. thanks alot, |
@chaos-prevails just enable the external storage app but in the admin interface do not give the users the permission to add external storages, this should take care of the remember login checkbox. |
Thanks, that did the trick. However, even when disabling the ability to add external storage, the "external storage" link at the left side menu shows up for all users. Probably there is a more direct way to hide the checkbox? I might rather try the old app on NC11. |
well, if I would know how the external storage kicks out the checkbox we could solve both our problems. otherwise you may play with the login page files and remove anything regarding the checkbox. |
I'm not sure whether the checkbox is disappearing without reason when enabling the external storage app. probably it's not possible any more due to the login necessities to the external storage sites? (I have no idea, sorry). I will try out the old app to check whether it works on NC11 |
This is how it kicks out the checkbox:
|
@MorrisJobke oh my god, why did I overlook that? I did check the metafiles iirc. thanks, seriously. |
I have to revert my answer from yesterday, actually none of the two things I try to achieve work out:
my config settings: beside client/browser specific issues (private browsing, etc), is there something else I have to consider so that it works out of the box browser-independently? thanks btw: I deleted all old cookies before testing and hide the remember login checkbox with the help of @MorrisJobke yesterday. |
fixes #1067
I somehow refactored away the remember-me funcionality while working on the auth code 🙈
TODO:
update session token in the DBduplicate token, otherwise the validation fails and the user is logged outcc @LukasReschke