Allow a contact page to require users to be logged in to use it

Bug: T199249
Change-Id: I23aad0f6bff14ce80ca8cacc554fcb48ca3473be
This commit is contained in:
Reedy 2018-07-10 18:08:33 +01:00
parent 2c7195a087
commit 1ae72a8dc4
4 changed files with 10 additions and 2 deletions

View File

@ -25,6 +25,7 @@
"SenderName": null,
"RequireDetails": false,
"IncludeIP": false,
"MustBeLoggedIn": false,
"RLModules": [],
"RLStyleModules": [],
"AdditionalFields": {

View File

@ -20,5 +20,6 @@
"contactpage-usermailererror": "Mail object returned error:",
"contactpage-captcha-error": "CAPTCHA error",
"contactpage-config-error-title": "Contact form error",
"contactpage-config-error": "A contact form is either not configured for this page or is configured incorrectly."
"contactpage-config-error": "A contact form is either not configured for this page or is configured incorrectly.",
"contactpage-mustbeloggedin": "Please log in to submit a contact form."
}

View File

@ -26,5 +26,6 @@
"contactpage-usermailererror": "Error message displayed when no email could be sent by the MediWiki UserMailer script.",
"contactpage-captcha-error": "Error message displayed when there was a CAPTCHA error (i.e. the user failed to enter the correct CAPTCHA, or didn't enter one at all, etc.)",
"contactpage-config-error-title": "Page title of Special:Contact when the requested form is configured incorrectly.",
"contactpage-config-error": "Used as the content of Special:Contact when the requested form is configured incorrectly."
"contactpage-config-error": "Used as the content of Special:Contact when the requested form is configured incorrectly.",
"contactpage-mustbeloggedin": "Showed on Special:Userlogin when user tries to use a Contact Page that requires them to be logged in."
}

View File

@ -75,6 +75,11 @@ class SpecialContact extends UnlistedSpecialPage {
$this->formType = strtolower( $request->getText( 'formtype', $par ) );
$config = $this->getTypeConfig();
if ( $config['MustBeLoggedIn'] ) {
$this->requireLogin( 'contactpage-mustbeloggedin' );
}
if ( !$config['RecipientUser'] ) {
$this->getOutput()->showErrorPage( 'contactpage-config-error-title',
'contactpage-config-error' );