r25667 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25666‎ | r25667 | r25668 >
Date:17:42, 8 September 2007
Author:evan
Status:old
Tags:
Comment:
Two changes to the Consumer:

1) Add a cookie containing the OpenID identifier on successful login.
This is in anticipation of future enhancements that will auto-login if
the OpenID ID is set, and the user is logged into their OP.
2) Change the login default from deny everyone by default to allow
everyone by default.
Modified paths:
  • /trunk/extensions/OpenID/Consumer.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenID/Consumer.php
@@ -37,7 +37,7 @@
3838 # If false, works like "Order Deny,Allow" in Apache; allow by default,
3939 # deny items in deny that aren't in allow.
4040
41 - $wgOpenIDConsumerDenyByDefault = true;
 41+ $wgOpenIDConsumerDenyByDefault = false;
4242
4343 # Which partners to allow; regexps here. See above.
4444
@@ -58,6 +58,12 @@
5959
6060 $wgOpenIDConsumerStorePath = NULL;
6161
 62+ # Expiration time for the OpenID cookie. Lets the user re-authenticate
 63+ # automatically if their session is expired. Only really useful if
 64+ # it's much greater than $wgCookieExpiration. Default: about one year.
 65+
 66+ $wgOpenIDCookieExpiration = 365 * 24 * 60 * 60;
 67+
6268 function wfSpecialOpenIDLogin($par) {
6369 global $wgRequest, $wgUser, $wgOut;
6470
@@ -195,6 +201,10 @@
196202
197203 wfRunHooks('UserLoginComplete', array(&$wgUser));
198204
 205+ # Set a cookie for later check-immediate use
 206+
 207+ OpenIDLoginSetCookie($openid);
 208+
199209 $wgOut->setPageTitle( wfMsg( 'openidsuccess' ) );
200210 $wgOut->setRobotpolicy( 'noindex,nofollow' );
201211 $wgOut->setArticleRelated( false );
@@ -202,6 +212,15 @@
203213 $wgOut->returnToMain( );
204214 }
205215
 216+ function OpenIDLoginSetCookie($openid) {
 217+ global $wgCookiePath, $wgCookieDomain, $wgCookieSecure, $wgCookiePrefix;
 218+ global $wgOpenIDCookieExpiration;
 219+
 220+ $exp = time() + $wgOpenIDCookieExpiration;
 221+
 222+ setcookie($wgCookiePrefix.'OpenID', $openid, $exp, $wgCookiePath, $wgCookieDomain, $wgCookieSecure);
 223+ }
 224+
206225 function OpenIDLoginForm() {
207226 global $wgOut, $wgUser;
208227 $sk = $wgUser->getSkin();
@@ -771,3 +790,4 @@
772791 }
773792 }
774793
 794+?>

Status & tagging log