Consistently handle anonymous users on logged-in-only special pages
authorBartosz Dziewoński <matma.rex@gmail.com>
Sat, 12 Oct 2013 17:00:23 +0000 (19:00 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Tue, 19 Nov 2013 11:03:49 +0000 (12:03 +0100)
commit68f3a22654ab5fbc2da48413f6d4ad86fe532a6e
tree86103c677cb1d910415c7a5dc93d73fd072d5d80
parenta55e363f50c071631881487416daa49397386252
Consistently handle anonymous users on logged-in-only special pages

Added new helper function SpecialPage#requireLogin() to check if the
current user is logged in and, if not, format an error message linking
to Special:Userlogin and throw UserNotLoggedIn exception, to be
handled by OutputPage later.

Reused old error messages. Not all use the new parameter and they're
very inconsistent, but this is a matter for another patch.

Used it on 7 special pages. I don't think there are any other ones
which specifically require having an account, instead of just some
rights usually associated with logged-in users.

* SpecialChangeEmail
* SpecialChangePassword: It allows anonymous users under specific
  circumstances, but is logged-in-only in general.
* SpecialConfirmemail
* SpecialEditWatchlist
* SpecialPreferences
* SpecialResetTokens: It was missing the check, added it.
* SpecialWatchlist

Change-Id: I43ceaddb370d09784021b3fc2d5d1ff6616fef1f
12 files changed:
includes/SpecialPage.php
includes/specials/SpecialChangeEmail.php
includes/specials/SpecialChangePassword.php
includes/specials/SpecialConfirmemail.php
includes/specials/SpecialEditWatchlist.php
includes/specials/SpecialPreferences.php
includes/specials/SpecialResetTokens.php
includes/specials/SpecialWatchlist.php
languages/messages/MessagesEn.php
languages/messages/MessagesQqq.php
maintenance/dictionary/mediawiki.dic
maintenance/language/messages.inc