Merge "Sanitize TestUser"
[lhc/web/wiklou.git] / includes / api / ApiEmailUser.php
index 1a4d67d..9870b2d 100644 (file)
@@ -40,7 +40,11 @@ class ApiEmailUser extends ApiBase {
                }
 
                // Check permissions and errors
-               $error = SpecialEmailUser::getPermissionsError( $this->getUser(), $params['token'] );
+               $error = SpecialEmailUser::getPermissionsError(
+                       $this->getUser(),
+                       $params['token'],
+                       $this->getConfig()
+               );
                if ( $error ) {
                        $this->dieUsageMsg( array( $error ) );
                }
@@ -94,10 +98,6 @@ class ApiEmailUser extends ApiBase {
                                ApiBase::PARAM_TYPE => 'string',
                                ApiBase::PARAM_REQUIRED => true
                        ),
-                       'token' => array(
-                               ApiBase::PARAM_TYPE => 'string',
-                               ApiBase::PARAM_REQUIRED => true
-                       ),
                        'ccme' => false,
                );
        }
@@ -107,7 +107,6 @@ class ApiEmailUser extends ApiBase {
                        'target' => 'User to send email to',
                        'subject' => 'Subject header',
                        'text' => 'Mail body',
-                       'token' => 'A token previously acquired via prop=info',
                        'ccme' => 'Send a copy of this mail to me',
                );
        }
@@ -117,16 +116,12 @@ class ApiEmailUser extends ApiBase {
        }
 
        public function needsToken() {
-               return true;
-       }
-
-       public function getTokenSalt() {
-               return '';
+               return 'csrf';
        }
 
        public function getExamples() {
                return array(
-                       'api.php?action=emailuser&target=WikiSysop&text=Content'
+                       'api.php?action=emailuser&target=WikiSysop&text=Content&token=123ABC'
                                => 'Send an email to the User "WikiSysop" with the text "Content"',
                );
        }