function internalProcessCreateAccount($options, $nomail = false)
 {
     if (empty($options['username'])) {
         $this->mErrors[] = 'noname';
         return false;
     }
     $username = $options['username'];
     unset($options['username']);
     global $wgAuth;
     $password = $wgAuth->createAccount($username, $options);
     $userprops = UserProps::loadFromDb($username);
     if (!$userprops) {
         $this->mErrors[] = 'nss-db-error';
         return false;
     }
     $this->users[$userprops->getName()] = $userprops;
     if ($nomail) {
         return true;
     }
     global $wgPasswordSender;
     $email = wfMsg('nss-welcome-mail', $username, $password);
     $mailSubject = wfMsg('nss-welcome-mail-subject');
     $mailFrom = new MailAddress($wgPasswordSender);
     $mailTo = new MailAddress(User::newFromName($username));
     $mailResult = UserMailer::send($mailTo, $mailFrom, $mailSubject, $email);
     if (WikiError::isError($mailResult)) {
         $this->mErrors[] = $mailResult->getMessage();
         return false;
     }
     return true;
 }
Example #2
0
 public function testStandardToStringIncludesClassAndModelsId()
 {
     $model = new UserProps();
     $model->setId('id');
     $expected = str_replace('\\', '.', strtolower(get_class($model))) . ':' . $model->getId();
     $this->assertEquals($expected, (string) $model);
 }