EddieGP has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/342491 )
Change subject: Show better error for anons on Special:EmailUser
......................................................................
Show better error for anons on Special:EmailUser
When a anon user visits Special:EmailUser, the PermissionError message
is shown (as only members of the group "user" (all logged in users) are
allowed to do this). There is a better error message, which tells "You
must be logged in and have a valid email adress in your preferences."
available, but was only shown to users who are logged in but did not
have a valid mail adress in their settings, because the check for the
permission "emailuser" happened before the check for the valid mail
(which returns false for anon users). Exchanging the order of those
makes the right error message appear.
Bug: T160309
Change-Id: I26175df1f7577937d9781950058ca458984ce2cb
---
M includes/specials/SpecialEmailuser.php
1 file changed, 5 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/91/342491/1
diff --git a/includes/specials/SpecialEmailuser.php
b/includes/specials/SpecialEmailuser.php
index 085b68d..a69406c 100644
--- a/includes/specials/SpecialEmailuser.php
+++ b/includes/specials/SpecialEmailuser.php
@@ -231,14 +231,15 @@
return 'usermaildisabled';
}
- if ( !$user->isAllowed( 'sendemail' ) ) {
- return 'badaccess';
- }
-
+ // Run this before $user->isAllowed, to show appropriate
message to anons (T160309)
if ( !$user->isEmailConfirmed() ) {
return 'mailnologin';
}
+ if ( !$user->isAllowed( 'sendemail' ) ) {
+ return 'badaccess';
+ }
+
if ( $user->isBlockedFromEmailuser() ) {
wfDebug( "User is blocked from sending e-mail.\n" );
--
To view, visit https://gerrit.wikimedia.org/r/342491
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I26175df1f7577937d9781950058ca458984ce2cb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: EddieGP <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits