[Mediawiki-l] Automatic Login using get_current_user()

J Wolfgang Goerlich jwgoerlich at gmail.com
Thu Jan 4 12:25:20 UTC 2007


Ryan Lane wrote:
> Why are you setting this stuff after you create the user
> (form->initUser)? And why aren't you doing it through the authentication
> plugin's initUser() function? Normally all of this stuff is set before
> the user is created.

I tried filling the request variables and calling the form-post
because the initUser() did not appear to set the values. They still do
not. Perhaps I am missing some necessary code in that block? (See
below.)

I agree with you. I should change from a static universal password to
a pseudo-random or blank password. First, though, I should get the
auto-create function to work.

Regards,

J Wolfgang Goerlich


function initUser(&$user) {
 // Current user, email domain, and universal password

 global $_SERVER;
 $cu = get_current_user();
 $domain = "munder.com";
 $pass = "1Some2Secret3Password4";

 // Populate information for this user

 $user->setEmail($cu . "@" . $domain);
 $user->setRealName( $cu );
 $wgUser->setPassword=$pass;

 $user->mEmailAuthenticated = wfTimestampNow();
 $user->setToken();

 // Disable e-mail notifications by default
 $user->setOption('enotifwatchlistpages', 0);
 $user->setOption('enotifusertalkpages', 0);
 $user->setOption('enotifminoredits', 0);
 $user->setOption('enotifrevealaddr', 0);
}



More information about the MediaWiki-l mailing list