r96609 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96608‎ | r96609 | r96610 >
Date:20:04, 8 September 2011
Author:laner
Status:deferred (Comments)
Tags:ldap 
Comment:
Adding support for domain in mail-me-a-password form.
Modified paths:
  • /trunk/extensions/LdapAuthentication/LdapAuthentication.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LdapAuthentication/LdapAuthentication.php
@@ -88,6 +88,7 @@
8989 $wgLDAPUniqueBlockLogin = array(); //Currently unused
9090 $wgLDAPUniqueRenameUser = array(); //Currently unused
9191 $wgLDAPUseFetchedUsername = array();
 92+$wgPasswordResetRoutes['domain'] = true;
9293
9394 define( "LDAPAUTHVERSION", "1.2f" );
9495
@@ -440,9 +441,7 @@
441442 * @access public
442443 */
443444 function modifyUITemplate( &$template ) {
444 - global $wgLDAPDomainNames, $wgLDAPUseLocal;
445445 global $wgLDAPAddLDAPUsers;
446 - global $wgLDAPAutoAuthDomain;
447446 global $wgLDAPMailPassword;
448447
449448 $this->printDebug( "Entering modifyUITemplate", NONSENSITIVE );
@@ -455,6 +454,14 @@
456455 $template->set( 'useemail', isset( $wgLDAPMailPassword[$_SESSION['wsDomain']] ) && $wgLDAPMailPassword[$_SESSION['wsDomain']] );
457456 $template->set( 'canreset', isset( $wgLDAPMailPassword[$_SESSION['wsDomain']] ) && $wgLDAPMailPassword[$_SESSION['wsDomain']] );
458457
 458+
 459+ $template->set( 'domainnames', $this->domainList() );
 460+ wfRunHooks( 'LDAPModifyUITemplate', array( &$template ) );
 461+ }
 462+
 463+ function domainList() {
 464+ global $wgLDAPDomainNames, $wgLDAPUseLocal, $wgLDAPAutoAuthDomain;
 465+
459466 $tempDomArr = $wgLDAPDomainNames;
460467 if ( $wgLDAPUseLocal ) {
461468 $this->printDebug( "Allowing the local domain, adding it to the list.", NONSENSITIVE );
@@ -469,8 +476,11 @@
470477 unset( $tempDomArr[array_search( $wgLDAPAutoAuthDomain, $tempDomArr )] );
471478 }
472479
473 - $template->set( 'domainnames', $tempDomArr );
474 - wfRunHooks( 'LDAPModifyUITemplate', array( &$template ) );
 480+ $domains = array();
 481+ foreach ( $tempDomArr as $tempDom ) {
 482+ $domains["$tempDom"] = $tempDom;
 483+ }
 484+ return $domains;
475485 }
476486
477487 /**

Comments

#Comment by Nikerabbit (talk | contribs)   04:51, 9 September 2011
+		$domains = array();
+		foreach ( $tempDomArr as $tempDom ) {
+			$domains["$tempDom"] = $tempDom;
+		}

This looks weird? What is it supposed to do?

#Comment by Ryan lane (talk | contribs)   04:55, 9 September 2011

HTMLForm option lists need to be an associative array, correct?

#Comment by Nikerabbit (talk | contribs)   05:27, 9 September 2011

I guess so, but does it need string keys?

Status & tagging log