very basic support for requiring email authentication before allowing users
authorErik Moeller <erik@users.mediawiki.org>
Fri, 10 Feb 2006 09:34:31 +0000 (09:34 +0000)
committerErik Moeller <erik@users.mediawiki.org>
Fri, 10 Feb 2006 09:34:31 +0000 (09:34 +0000)
to edit

includes/DefaultSettings.php
includes/EditPage.php
languages/Messages.php

index 1841eba..7ebf727 100644 (file)
@@ -778,6 +778,12 @@ $wgBlockAllowsUTEdit    = false; # Blocks allow users to edit their own user tal
 # directory name unguessable, or use .htaccess to protect it.
 $wgWhitelistRead = false;
 
+/** 
+ * Should editors be required to have a validated e-mail
+ * address before being allowed to edit?
+ */
+$wgEmailConfirmToEdit=false;
+
 /**
  * Permission keys given to users in each group.
  * All users are implicitly in the '*' group including anonymous visitors;
index 66bf97f..f66ce4a 100644 (file)
@@ -153,7 +153,8 @@ class EditPage {
         * the newly-edited page.
         */
        function edit() {
-               global $wgOut, $wgUser, $wgRequest, $wgTitle;
+               global $wgOut, $wgUser, $wgRequest, $wgTitle,
+                      $wgEmailConfirmToEdit;
 
                if ( ! wfRunHooks( 'AlternateEdit', array( &$this  ) ) )
                        return;
@@ -202,6 +203,12 @@ class EditPage {
                                return;
                        }
                }
+               if ($wgEmailConfirmToEdit && !$wgUser->isEmailConfirmed()) {
+                       wfDebug("$fname: user must confirm e-mail address\n");
+                       $this->userNotConfirmedPage();
+                       wfProfileOut($fname);
+                       return;
+               }
                if ( !$this->mTitle->userCan( 'create' ) && !$this->mTitle->exists() ) {
                        wfDebug( "$fname: no create permission\n" );
                        $this->noCreatePermission();
@@ -1166,6 +1173,17 @@ END
                $wgOut->returnToMain( false );
        }
 
+       function userNotConfirmedPage() {
+
+               global $wgOut;
+
+               $wgOut->setPageTitle( wfMsg( 'confirmedittitle' ) );
+               $wgOut->setRobotpolicy( 'noindex,nofollow' );
+               $wgOut->setArticleRelated( false );
+               $wgOut->addWikiText( wfMsg( 'confirmedittext' ) );
+               $wgOut->returnToMain( false );
+       }
+
        /**
         * @todo document
         */
index 1beb6a5..527dcba 100644 (file)
@@ -465,6 +465,8 @@ Your IP address is $3. Please include this address in any queries you make.',
 'whitelistreadtext' => 'You have to [[Special:Userlogin|login]] to read pages.',
 'whitelistacctitle' => 'You are not allowed to create an account',
 'whitelistacctext' => 'To be allowed to create accounts in this Wiki you have to [[Special:Userlogin|log]] in and have the appropriate permissions.',
+'confirmedittitle' => 'E-mail confirmation required to edit',
+'confirmedittext' => 'You must confirm your e-mail address before editing pages. Please set and validate your e-mail address through your [[Special:Preferences|user preferences]].',
 'loginreqtitle'        => 'Login Required',
 'loginreqlink' => 'login',
 'loginreqpagetext'     => 'You must $1 to view other pages.',