Thread:Extension talk:LDAP Authentication/$wgLDAPUseLocal and the template's 'useemail' property/reply (2)

Hi,

I'd like to put everything together here so other users will benefit.

First of all, this post (my post, I mean!) does not care about $wgLDAPUseLocal.

What I'm interested here are these 2 Requirements:
 * ability to send a temporary password (reset password) in the login form;
 * ability to require obligatory email address in the register form.

The solution is:

1. Make sure you define $wgLDAPMailPassword like shown below:

$wgSitename = "MyWebsite"; // or whatever it is in reality $wgLDAPMailPassword = array( $wgSitename => true, "invaliddomain" => true );

2. You will need to edit LdapAuthorization.php and modify method modifyUITemplate, like explained below:

The code was:

$template->set( 'usedomain', true ); $template->set( 'useemail', false );

... which needs to be substituted by:

$template->set( 'usedomain', true );

global $wgLDAPMailPassword; $template->set( 'useemail', isset( $wgLDAPMailPassword[$_SESSION['wsDomain']] ) && $wgLDAPMailPassword[$_SESSION['wsDomain']] ); $template->set( 'canreset', isset( $wgLDAPMailPassword[$_SESSION['wsDomain']] ) && $wgLDAPMailPassword[$_SESSION['wsDomain']] );

That's it. I hope it helps.

Thanks