* (bug 12142) CAPTCHA group exceptions only apply to edits
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 7 Aug 2008 17:05:10 +0000 (17:05 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 7 Aug 2008 17:05:10 +0000 (17:05 +0000)
Applies the 'skipcaptcha' permission check also to the user creation form.
Patch by Emufarmers - https://bugzilla.wikimedia.org/attachment.cgi?id=5132

ConfirmEdit_body.php

index cd68f5cb678da9655ca035db04ddbce4c61eaf00..9e451ab1f88423245c91481c4367b80502bb399d 100644 (file)
@@ -145,8 +145,12 @@ class SimpleCaptcha {
         * @return bool true to keep running callbacks
         */
        function injectUserCreate( &$template ) {
         * @return bool true to keep running callbacks
         */
        function injectUserCreate( &$template ) {
-               global $wgCaptchaTriggers, $wgOut;
+               global $wgCaptchaTriggers, $wgOut, $wgUser;
                if( $wgCaptchaTriggers['createaccount'] ) {
                if( $wgCaptchaTriggers['createaccount'] ) {
+                       if( $wgUser->isAllowed( 'skipcaptcha' ) ) {
+                               wfDebug( "ConfirmEdit: user group allows skipping captcha on account creation\n" );
+                               return true;
+                       }
                        $template->set( 'header',
                                "<div class='captcha'>" .
                                $wgOut->parse( $this->getMessage( 'createaccount' ) ) .
                        $template->set( 'header',
                                "<div class='captcha'>" .
                                $wgOut->parse( $this->getMessage( 'createaccount' ) ) .
@@ -513,8 +517,12 @@ class SimpleCaptcha {
         * @return bool true to continue, false to abort user creation
         */
        function confirmUserCreate( $u, &$message ) {
         * @return bool true to continue, false to abort user creation
         */
        function confirmUserCreate( $u, &$message ) {
-               global $wgCaptchaTriggers;
+               global $wgCaptchaTriggers, $wgUser;
                if( $wgCaptchaTriggers['createaccount'] ) {
                if( $wgCaptchaTriggers['createaccount'] ) {
+                       if( $wgUser->isAllowed( 'skipcaptcha' ) ) {
+                               wfDebug( "ConfirmEdit: user group allows skipping captcha on account creation\n" );
+                               return true;
+                       }
                        $this->trigger = "new account '" . $u->getName() . "'";
                        if( !$this->passCaptcha() ) {
                                $message = wfMsg( 'captcha-createaccount-fail' );
                        $this->trigger = "new account '" . $u->getName() . "'";
                        if( !$this->passCaptcha() ) {
                                $message = wfMsg( 'captcha-createaccount-fail' );