Password protected user registrations

From Meta, a Wikimedia project coordination wiki

Jump to: navigation, search

I wanted to use a wiki for my home site, but I only want family members to be able to edit it.

So I modified the user login page to require a special password.

[edit] includes/SpecialUserlogin.php

In:

class LoginForm {

I added:

var $mAddAccountPassword;

In:

function LoginForm( &$request ) {

I added:

 $this->mAddAccountPassword = $request->getText( 'wpAddAccountPassword' );

In:

 function execute() {

I modified:

 if( $this->mCreateaccount ) {
   return $this->addNewAccount();

to:

 if( $this->mCreateaccount ) {
   if ($this->mAddAccountPassword == 'passwordhere')
     return $this->addNewAccount();

[edit] includes/templates/UserLogin.php

Right near the end, just before:

</table>
</form>
<?php

I added a line:

<tr><td><input type=text size=20 name="wpAddAccountPassword" id="wpAddAccountPassword"></td></tr>