Index: trunk/extensions/CentralAuth/CentralAuthUser.php |
— | — | @@ -363,8 +363,11 @@ |
364 | 364 | // we can use it to match other accounts. If it doesn't, |
365 | 365 | // we can't be sure that the other accounts with no mail |
366 | 366 | // are the same person, so err on the side of caution. |
| 367 | + // |
| 368 | + // For additional safety, we'll only let the mail check |
| 369 | + // propagate from a confirmed account |
367 | 370 | $passingMail = array(); |
368 | | - if( $this->mEmail != '' ) { |
| 371 | + if( $this->mEmail != '' && $this->mEmailAuthenticated ) { |
369 | 372 | $passingMail[$this->mEmail] = true; |
370 | 373 | } |
371 | 374 | |
— | — | @@ -373,6 +376,7 @@ |
374 | 377 | if( $passwords ) { |
375 | 378 | foreach( $migrationSet as $db => $local ) { |
376 | 379 | if( $local['email'] != '' |
| 380 | + && $local['emailAuthenticated'] |
377 | 381 | && $this->matchHashes( $passwords, $local['id'], $local['password'] ) ) { |
378 | 382 | $passingMail[$local['email']] = true; |
379 | 383 | } |
— | — | @@ -419,9 +423,10 @@ |
420 | 424 | * @param string &$home set to false if no permission to do checks |
421 | 425 | * @param array &$attached on success, list of wikis which will be auto-attached |
422 | 426 | * @param array &$unattached on success, list of wikis which won't be auto-attached |
| 427 | + * @param array &$methods on success, associative array of each wiki's attachment method |
423 | 428 | * @return bool true if password matched current and home account |
424 | 429 | */ |
425 | | - function migrationDryRun( $passwords, &$home, &$attached, &$unattached ) { |
| 430 | + function migrationDryRun( $passwords, &$home, &$attached, &$unattached, &$methods ) { |
426 | 431 | global $wgDBname; |
427 | 432 | |
428 | 433 | $home = false; |
— | — | @@ -449,14 +454,17 @@ |
450 | 455 | |
451 | 456 | $this->mHomeWiki = $home; |
452 | 457 | $this->mEmail = $local['email']; |
| 458 | + $this->mEmailAuthenticated = $local['emailAuthenticated']; |
453 | 459 | $attach = $this->prepareMigration( $migrationSet, $passwords ); |
454 | 460 | |
455 | 461 | $all = array_keys( $migrationSet ); |
456 | 462 | $attached = array_keys( $attach ); |
457 | 463 | $unattached = array_diff( $all, $attached ); |
| 464 | + $methods = $attach; |
458 | 465 | |
459 | 466 | sort( $attached ); |
460 | 467 | sort( $unattached ); |
| 468 | + ksort( $methods ); |
461 | 469 | |
462 | 470 | return true; |
463 | 471 | } |
— | — | @@ -473,6 +481,7 @@ |
474 | 482 | $this->mHomeWiki = $this->chooseHomeWiki( $migrationSet ); |
475 | 483 | $home = $migrationSet[$this->mHomeWiki]; |
476 | 484 | $this->mEmail = $home['email']; |
| 485 | + $this->mEmailAuthenticated = $home['emailAuthenticated']; |
477 | 486 | |
478 | 487 | $attach = $this->prepareMigration( $migrationSet, $passwords ); |
479 | 488 | |
Index: trunk/extensions/CentralAuth/SpecialMergeAccount.php |
— | — | @@ -159,7 +159,8 @@ |
160 | 160 | $home = false; |
161 | 161 | $attached = array(); |
162 | 162 | $unattached = array(); |
163 | | - $ok = $globalUser->migrationDryRun( $passwords, $home, $attached, $unattached ); |
| 163 | + $methods = array(); |
| 164 | + $ok = $globalUser->migrationDryRun( $passwords, $home, $attached, $unattached, $methods ); |
164 | 165 | |
165 | 166 | if( $ok ) { |
166 | 167 | // This is the global account or matched it |
— | — | @@ -185,7 +186,7 @@ |
186 | 187 | } |
187 | 188 | |
188 | 189 | $subAttached = array_diff( $attached, array( $home ) ); |
189 | | - $wgOut->addHtml( $this->step3ActionForm( $home, $subAttached ) ); |
| 190 | + $wgOut->addHtml( $this->step3ActionForm( $home, $subAttached, $methods ) ); |
190 | 191 | |
191 | 192 | } elseif( $home ) { |
192 | 193 | $wgOut->addWikiText( "The migration system couldn't confirm that you're the owner of the home wiki account for your username." . |
— | — | @@ -338,39 +339,37 @@ |
339 | 340 | } |
340 | 341 | } |
341 | 342 | |
342 | | - function listAttached( $dblist ) { |
343 | | - return $this->listForm( $dblist, 'unmerge', wfMsg( 'centralauth-admin-unmerge' ) ); |
| 343 | + function listAttached( $dblist, $methods=array() ) { |
| 344 | + return $this->listWikis( $dblist, $methods ); |
344 | 345 | } |
345 | 346 | |
346 | 347 | function listUnattached( $dblist ) { |
347 | | - return $this->listForm( $dblist, 'admin', wfMsg( 'centralauth-admin-merge' ) ); |
| 348 | + return $this->listWikis( $dblist ); |
348 | 349 | } |
349 | 350 | |
350 | | - function listForm( $dblist /* Params not used: , $action, $buttonText */ ) { |
351 | | - $list = $this->listWikis( $dblist ); |
352 | | - |
353 | | - return $list; |
354 | | - } |
355 | | - |
356 | | - function listWikis( $list ) { |
| 351 | + function listWikis( $list, $methods=array() ) { |
357 | 352 | asort( $list ); |
358 | | - return $this->formatList( $list, array( $this, 'listWikiItem' ) ); |
| 353 | + return $this->formatList( $list, $methods, array( $this, 'listWikiItem' ) ); |
359 | 354 | } |
360 | 355 | |
361 | | - function formatList( $items, $callback ) { |
| 356 | + function formatList( $items, $methods, $callback ) { |
362 | 357 | if( empty( $items ) ) { |
363 | 358 | return ''; |
364 | 359 | } else { |
| 360 | + $itemMethods = array(); |
| 361 | + foreach( $items as $item ) { |
| 362 | + $itemMethods[] = isset( $methods[$item] ) ? $methods[$item] : ''; |
| 363 | + } |
365 | 364 | return "<ul>\n<li>" . |
366 | 365 | implode( "</li>\n<li>", |
367 | | - array_map( $callback, $items ) ) . |
| 366 | + array_map( $callback, $items, $itemMethods ) ) . |
368 | 367 | "</li>\n</ul>\n"; |
369 | 368 | } |
370 | 369 | } |
371 | 370 | |
372 | | - function listWikiItem( $dbname ) { |
| 371 | + function listWikiItem( $dbname, $method ) { |
373 | 372 | return |
374 | | - $this->foreignUserLink( $dbname ); |
| 373 | + $this->foreignUserLink( $dbname ) . ' ' . $method; |
375 | 374 | } |
376 | 375 | |
377 | 376 | function foreignUserLink( $dbname ) { |
— | — | @@ -463,7 +462,7 @@ |
464 | 463 | wfMsg( 'centralauth-merge-step2-submit' ) ); |
465 | 464 | } |
466 | 465 | |
467 | | - private function step3ActionForm( $home, $attached ) { |
| 466 | + private function step3ActionForm( $home, $attached, $methods ) { |
468 | 467 | global $wgUser; |
469 | 468 | return $this->actionForm( |
470 | 469 | 'initial', |
— | — | @@ -471,12 +470,12 @@ |
472 | 471 | wfMsgExt( 'centralauth-merge-step3-detail', 'parse', $wgUser->getName() ) . |
473 | 472 | '<h3>' . wfMsgHtml( 'centralauth-list-home-title' ) . '</h3>' . |
474 | 473 | wfMsgExt( 'centralauth-list-home-dryrun', 'parse' ) . |
475 | | - $this->listAttached( array( $home ) ) . |
| 474 | + $this->listAttached( array( $home ), $methods ) . |
476 | 475 | ( count( $attached ) |
477 | 476 | ? ( '<h3>' . wfMsgHtml( 'centralauth-list-attached-title' ) . '</h3>' . |
478 | 477 | wfMsgExt( 'centralauth-list-attached-dryrun', 'parse', $wgUser->getName() ) ) |
479 | 478 | : '' ) . |
480 | | - $this->listAttached( $attached ) . |
| 479 | + $this->listAttached( $attached, $methods ) . |
481 | 480 | '<p>' . |
482 | 481 | Xml::submitButton( wfMsg( 'centralauth-merge-step3-submit' ), |
483 | 482 | array( 'name' => 'wpLogin' ) ) . |