Page MenuHomePhabricator

Users without their e-mail confirmed get an error when trying to upload avatar
Closed, ResolvedPublic

Description

My Wiki has e-mail authentication ($wgEmailConfirmToEdit = true;) set to help prevent vandalism. Some users realized that they are unable to upload avatars before they confirm their e-mail because this error message appears: https://jojowiki.com/Special:WikiForum/Avatar_Errors

This makes sense since I don't think they're allowed to upload files before they confirm their e-mail. Is there a way to display a cleaner message like "Please confirm your e-mail address before uploading avatar" instead of the backtrace? Thanks.

Event Timeline

Change 553699 had a related patch set uploaded (by Jack Phoenix; owner: Jack Phoenix):
[mediawiki/extensions/SocialProfile@master] Don't die horribly when email confirmation is required to edit pages and a user w/ an unconfirmed email tries to upload an avatar via Special:UploadAvatar

https://gerrit.wikimedia.org/r/553699

Change 553699 merged by jenkins-bot:
[mediawiki/extensions/SocialProfile@master] Don't die horribly when email confirmation is required to edit pages and a user w/ an unconfirmed email tries to upload an avatar via Special:UploadAvatar

https://gerrit.wikimedia.org/r/553699

ashley claimed this task.
ashley removed a project: Patch-For-Review.
ashley subscribed.

Thanks for the bug report! This should now be fixed by the above commit (tested on MW 1.33.0, without AbuseFilter installed though).

Note that since we're essentially using the core MW methods, much like how the regular Special:Upload page uses 'em, the i18n message displayed is confirmedittext, which somewhat misleadingly (for our use case) reads by default "You must confirm your email address before editing pages"; this makes sense for regular file uploads as regular files have an associated on-wiki File: page, but avatar images don't. Furthermore just like with Special:Upload, the error message is displayed *after* the user hits the "upload" button, not before. Regardless, the behavior of SocialProfile's Special:UploadAvatar should now be consistent with core Special:Upload page, for better or for worse. At least it's not fataling anymore should a user without a confirmed email attempt to upload an avatar when the wiki has $wgEmailConfirmToEdit = true; set.

Thanks for the quick patch. However, I made a test account and it seems to be resolved when AbuseFilter is disabled, but it still shows the same error when it's on.

Change 553781 had a related patch set uploaded (by Jack Phoenix; owner: Jack Phoenix):
[mediawiki/extensions/SocialProfile@master] Set mFileProps in UploadAvatar#verifyUpload to keep AbuseFilter happy

https://gerrit.wikimedia.org/r/553781

Change 553781 merged by jenkins-bot:
[mediawiki/extensions/SocialProfile@master] Set mFileProps in UploadAvatar#verifyUpload to keep AbuseFilter happy

https://gerrit.wikimedia.org/r/553781