Jump to content

Password protected user registrations

From Meta, a Wikimedia project coordination wiki

I wanted to use a wiki for my home site, but I only want family members to be able to edit it. test So I modified the user login page to require a special password.

Suggest that files being edited are saved as file.ext.orig

This will prevent anybody that does not know you general registration password from registering to be able to login. To prevent those that are not logged in from editing any pages, see [1]

includes/specials/SpecialUserlogin.php

[edit]

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();

includes/templates/UserLogin.php

[edit]

Right near the end, just before:

</table>

I added a line:

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