Skip to content

Commit

Permalink
Add FICTIONEER_OAUTH_COOKIE_EXPIRATION constant
Browse files Browse the repository at this point in the history
  • Loading branch information
Tetrakern committed Nov 16, 2024
1 parent 0462456 commit 17d21c6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -1590,6 +1590,7 @@ define( 'CONSTANT_NAME', value );
| FICTIONEER_QUERY_RESULT_CACHE_THRESHOLD | integer | Count of a query result required to be eligible for caching. Default `50`.
| FICTIONEER_QUERY_RESULT_CACHE_LIMIT | integer | Number of query results cached if the feature is enabled. Default `50`.
| FICTIONEER_QUERY_RESULT_CACHE_BREAK | integer | Limit the number of large query result cache uploads per request. Default `3`.
| FICTIONEER_OAUTH_COOKIE_EXPIRATION | integer | Expiration time of the OAuth 2.0 login cookie in seconds. Default `259200` (3 days).
| FICTIONEER_CACHE_PURGE_ASSIST | boolean | Whether to call the cache purge assist function on post updates. Default `true`.
| FICTIONEER_RELATIONSHIP_PURGE_ASSIST | boolean | Whether to purge related post caches. Default `true`.
| FICTIONEER_SHOW_SEARCH_IN_MENUS | boolean | Whether to show search page links in menus. Default `true`.
Expand Down
5 changes: 5 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@ function fictioneer_add_epub_download_endpoint() {
define( 'FICTIONEER_QUERY_RESULT_CACHE_BREAK', 3 );
}

// Integer: OAuth login cookie lifetime
if ( ! defined( 'FICTIONEER_OAUTH_COOKIE_EXPIRATION' ) ) {
define( 'FICTIONEER_OAUTH_COOKIE_EXPIRATION', 3 * DAY_IN_SECONDS );
}

/*
* Booleans
*/
Expand Down
2 changes: 1 addition & 1 deletion includes/functions/_module-oauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ function fictioneer_oauth2_make_user( $user_data, $cookie ) {

// Allow login to last three days
add_filter( 'auth_cookie_expiration', function( $length ) {
return 3 * DAY_IN_SECONDS;
return FICTIONEER_OAUTH_COOKIE_EXPIRATION;
});

// Set authentication cookie
Expand Down

0 comments on commit 17d21c6

Please sign in to comment.