r42579 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42578‎ | r42579 | r42580 >
Date:21:31, 25 October 2008
Author:btongminh
Status:old
Tags:
Comment:
Sending an email containing the password would be handy.
Modified paths:
  • /trunk/extensions/NssMySQLAuth/SpecialAccountManager.php (modified) (history)

Diff [purge]

Index: trunk/extensions/NssMySQLAuth/SpecialAccountManager.php
@@ -188,13 +188,26 @@
189189 global $wgAuth;
190190 $password = $wgAuth->createAccount($username, $options);
191191
192 - $user = UserProps::loadFromDb( $username );
193 - if ( !$user ) {
 192+ $userprops = UserProps::loadFromDb( $username );
 193+ if ( !$userprops ) {
194194 $this->mErrors[] = 'nss-db-error';
195195 return false;
196196 }
197 - $this->users[$user->getName()] = $user;
 197+ $this->users[$userprops->getName()] = $userprops;
198198
 199+ global $wgPasswordSender;
 200+ $email = wfMsg( 'nss-welcome-mail', $username, $password );
 201+ $mailSubject = wfMsg( 'nss-welcome-mail-subject' );
 202+ $mailFrom = new MailAddress( $wgPasswordSender );
 203+ $mailTo = new MailAddress( User::newFromName( $username ) );
 204+
 205+ $mailResult = UserMailer::send( $mailTo, $mailFrom, $mailSubject, $email );
 206+
 207+ if ( WikiError::isError( $mailResult ) ) {
 208+ $this->mErrors[] = $mailResult->getMessage();
 209+ return false;
 210+ }
 211+
199212 return true;
200213 }
201214

Status & tagging log