r60582 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60581‎ | r60582 | r60583 >
Date:16:11, 3 January 2010
Author:ialex
Status:deferred
Tags:
Comment:
* (bug 18422) Special:OpenIDLogin now remembers user's OpenID URL
Modified paths:
  • /trunk/extensions/OpenID/OpenIDProvider.body.php (modified) (history)
  • /trunk/extensions/OpenID/SpecialOpenID.body.php (modified) (history)
  • /trunk/extensions/OpenID/SpecialOpenIDConvert.body.php (modified) (history)
  • /trunk/extensions/OpenID/SpecialOpenIDLogin.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenID/SpecialOpenIDLogin.body.php
@@ -266,11 +266,6 @@
267267 );
268268 }
269269
270 - function loginSetCookie( $openid ) {
271 - global $wgRequest, $wgOpenIDCookieExpiration;
272 - $wgRequest->response()->setcookie( 'OpenID', $openid, time() + $wgOpenIDCookieExpiration );
273 - }
274 -
275270 /**
276271 * Handle "Choose name" form submission
277272 */
Index: trunk/extensions/OpenID/SpecialOpenID.body.php
@@ -281,6 +281,11 @@
282282 }
283283 }
284284
 285+ function loginSetCookie( $openid ) {
 286+ global $wgRequest, $wgOpenIDCookieExpiration;
 287+ $wgRequest->response()->setcookie( 'OpenID', $openid, time() + $wgOpenIDCookieExpiration );
 288+ }
 289+
285290 # Find the user with the given openid, if any
286291 public static function getUserUrl( $user ) {
287292 $openid_urls = array();
Index: trunk/extensions/OpenID/SpecialOpenIDConvert.body.php
@@ -237,6 +237,8 @@
238238
239239 self::addUserUrl( $wgUser, $openid_url );
240240
 241+ $this->loginSetCookie( $openid_url );
 242+
241243 $wgOut->setPageTitle( wfMsg( 'openidconvertsuccess' ) );
242244 $wgOut->setRobotPolicy( 'noindex,nofollow' );
243245 $wgOut->setArticleRelated( false );
Index: trunk/extensions/OpenID/OpenIDProvider.body.php
@@ -37,13 +37,16 @@
3838 function getSmallButtonHTML() { return $this->getButtonHTML( false ); }
3939
4040 function getLoginFormHTML() {
 41+ global $wgCookiePrefix;
 42+
4143 $html = '<div id="provider_form_' . $this->id . '"' .
4244 ( $this->id == 'openid' ? '' : ' style="display:none"' ) . '>' .
4345 '<div><label for="openid_url">' . $this->label . '</label></div>';
4446
4547 if ( $this->id == 'openid' ) {
46 - $html .= '<input type="text" name="openid_url" id="openid_url" size="45" value="" />';
47 - $html .= '<input type="submit" value="' . wfMsg( 'login' ) . '"/>';
 48+ $url = isset( $_COOKIE[$wgCookiePrefix.'OpenID'] ) ? htmlspecialchars( $_COOKIE[$wgCookiePrefix.'OpenID'] ) : '';
 49+ $html .= '<input type="text" name="openid_url" id="openid_url" size="45" value="' . $url . '" />';
 50+ $html .= Xml::submitButton( wfMsg( 'login' ) );
4851 } else {
4952 $html .= '<input type="hidden" id="openid_provider_url_' . $this->id . '" value="' . $this->url . '" />';
5053 if ( strpos( $this->url, '{' ) === false ) {
@@ -51,7 +54,7 @@
5255 } else {
5356 $html .= '<input type="text" id="openid_provider_param_' . $this->id . '" size="25" value="" />';
5457 }
55 - $html .= '<input type="submit" value="' . wfMsg( 'login' ) . '"/>';
 58+ $html .= Xml::submitButton( wfMsg( 'login' ) );
5659 }
5760 $html .= '</div>';
5861

Status & tagging log