diff --git a/README.md b/README.md index ca788fc..cb0db3f 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ $wgOAuth2Client['configuration']['scopes'] = 'read_citizen_info'; //Permissions $wgOAuth2Client['configuration']['service_name'] = 'Citizen Registry'; // the name of your service $wgOAuth2Client['configuration']['service_login_link_text'] = 'Login with StarMade'; // the text of the login link +$wgOAuth2Client['configuration']['remember_me'] = true; // Whether to keep user logged in for longer, similarly to what would happen if they checked "Keep me logged in" in password-based login. See https://www.mediawiki.org/wiki/Manual:$wgCookieExpiration . Default: false. ``` diff --git a/SpecialOAuth2Client.php b/SpecialOAuth2Client.php index e9a263d..ae2b2b3 100644 --- a/SpecialOAuth2Client.php +++ b/SpecialOAuth2Client.php @@ -92,7 +92,7 @@ private function _redirect() { } private function _handleCallback(){ - global $wgRequest; + global $wgRequest, $wgOAuth2Client; try { $storedState = $wgRequest->getSession()->get('oauth2state'); @@ -117,7 +117,8 @@ private function _handleCallback(){ $resourceOwner = $this->_provider->getResourceOwner($accessToken); $user = $this->_userHandling( $resourceOwner->toArray() ); - $user->setCookies(); + $rememberMe = $wgOAuth2Client['configuration']['remember_me'] ?? false; + $user->setCookies(null, null, $rememberMe); global $wgOut, $wgRequest; $title = null;