feat(Sessions): Add remember me feature via a filter #513
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
All Submissions:
Changes proposed in this Pull Request:
Closes #512 .
This change allows the user to, using a filter, login users via the rememberme option in WordPress.
The wordpress login cookies will then be set for 14 days by default instead of two days as a session.
I originally wanted to use the token expiration date to do so, however this doesn't seem possible as you cannot pass an expiration date to the wp_set_auth_cookie function. So instead I chose to implement the remember me feature as used by WordPress itself.
What could maybe be possible is to dynamically add a filter for auth_cookie_expiration, so the WP user cookie expiration can be set to the same value. This filter needs to be added temporarily, and then removed.
However this is kind of hacky and i think it would be better to submit that as a separate PR after this one is approved.
How to test the changes in this Pull Request:
add_filter( 'openid-connect-generic-remember-me', '__return_true' );
to the functions.php file.Other information:
Changelog entry