Index: trunk/extensions/NssMySQLAuth/SpecialAccountManager.php |
— | — | @@ -188,13 +188,26 @@ |
189 | 189 | global $wgAuth; |
190 | 190 | $password = $wgAuth->createAccount($username, $options); |
191 | 191 | |
192 | | - $user = UserProps::loadFromDb( $username ); |
193 | | - if ( !$user ) { |
| 192 | + $userprops = UserProps::loadFromDb( $username ); |
| 193 | + if ( !$userprops ) { |
194 | 194 | $this->mErrors[] = 'nss-db-error'; |
195 | 195 | return false; |
196 | 196 | } |
197 | | - $this->users[$user->getName()] = $user; |
| 197 | + $this->users[$userprops->getName()] = $userprops; |
198 | 198 | |
| 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 | + |
199 | 212 | return true; |
200 | 213 | } |
201 | 214 | |