Page MenuHomePhabricator

Improve redirection logic when system expects a named user
Closed, ResolvedPublic2 Estimated Story Points

Description

We have two helpers in MediaWiki Core SpecialPage handlers:

SpecialPage::requireLogin()
SpecialPage::requireNamedUser()

Those methods are used to trigger user type check, and when current user do not match expectations we redirect them to the Special:Userlogin page.

This redirection logic is correct for anonymous users, but temporary users are already logged in. Instead of redirect them to the Login page we should redirect them to Special:CreateAccount page and let them create an account.

This ticket as a result of a phab comment thread. For more info please refer to: https://phabricator.wikimedia.org/T326816#9554849

Event Timeline

@Niharika @KColeman-WMF the idea in the task description sounds good to me. What do you think?

We probably also need to do T328718: [IP Masking] Do not show logged-in version of Special:CreateAccount page to temp accounts, so that the temporary account user has some additional information to guide them on Special:CreateAccount.

@Niharika @KColeman-WMF the idea in the task description sounds good to me. What do you think?

We probably also need to do T328718: [IP Masking] Do not show logged-in version of Special:CreateAccount page to temp accounts, so that the temporary account user has some additional information to guide them on Special:CreateAccount.

Yes, I agree we should do both of these tasks so it's clear to temp users what creating an account will entail.

Change #1075090 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/core@master] [WIP] Send temporary accounts to Special:CreateAccount on ::requireNamed

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

Change #1075154 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/core@master] Remove unused exception-nologin-text-manual message

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

Change #1075154 merged by jenkins-bot:

[mediawiki/core@master] Remove unused exception-nologin-text-manual message

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

Change #1075209 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/core@master] Remove unused 'resetpass-no-info' message key

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

Change #1075252 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/GlobalWatchlist@master] Update error message for temp users trying to use special pages

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

Change #1075268 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/OAuth@master] Update error message for temp users trying to use special pages

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

Change #1075271 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/ContactPage@master] Update error message for temp users trying to use special pages

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

Change #1075272 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/ReadingLists@master] Update error message for temp users trying to use special pages

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

Change #1075209 merged by jenkins-bot:

[mediawiki/core@master] Remove unused 'resetpass-no-info' message key

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

Change #1075090 merged by jenkins-bot:

[mediawiki/core@master] Send temporary accounts to Special:CreateAccount on ::requireNamed

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

Change #1075271 merged by jenkins-bot:

[mediawiki/extensions/ContactPage@master] Update error message for temp users trying to use special pages

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

Change #1075268 merged by jenkins-bot:

[mediawiki/extensions/OAuth@master] Update error message for temp users trying to use special pages

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

Change #1075252 merged by jenkins-bot:

[mediawiki/extensions/GlobalWatchlist@master] Update error message for temp users trying to use special pages

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

Change #1075272 merged by jenkins-bot:

[mediawiki/extensions/ReadingLists@master] Update error message for temp users trying to use special pages

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

Suggested QA steps:

part 1

  1. Create a temporary account
  2. Open Special:Preferences
  3. Check that you are taken to Special:CreateAccount and that a warning box indicates you should create an account to change preferences.
  4. Log out of your temporary account
  5. Open Special:Preferences
  6. Check that you are taken to Special:UserLogin and that a warning box indicates you should login to change your preferences

You may also wish to repeat the above suggested steps using a variety of other special pages that require the user to be logged in to a named account. For example, Special:ReadingLists and Special:Mute.

part 2

  1. Create a temporary account
  2. Open Special:ChangeEmail
  3. Check that you are taken to Special:UserLogin and that a warning box indicates you should log in to change your email.
  4. Log out of your temporary account
  5. Open Special:ChangeEmail
  6. Check the same things as in step 3
Djackson-ctr subscribed.

QA has been completed, and the new code changes are functioning as expected (temporary account users trying to access Special Pages will be redirected to the Special:CreateAccount page with a warning box, and when temporary account users log out and try to access Special Pages will be redirected to the Special:UserLogin page with a warning box)... Thank you for the QA Steps @Dreamy_Jazz, greatly appreciated!!!

image.png (510×1 px, 416 KB)

image.png (563×1 px, 251 KB)

image.png (430×1 px, 48 KB)

image.png (444×1 px, 231 KB)