Opened 8 years ago
Last modified 25 hours ago
#44550 assigned defect (bug)
The confirmaction page should also be in the user language
| Reported by: | birgire | Owned by: | garrett-eclipse |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Privacy | Version: | 4.9.6 |
| Severity: | normal | Keywords: | has-screenshots has-patch has-unit-tests needs-testing |
| Cc: | Focuses: | administration |
Description
We have the ticket
Privacy: The user request email should be sent in the user language #43985
so it seems reasonable to also have the "User action confirmed" page, in the same user language as the email.
Namely the page the user sees after clicking:
https://example.com/wp-login.php?action=confirmaction&request_id=...&confirm_key=...
from the "Confirm Action" email.
See screenshot below:
Attachments (5)
Change History (31)
This ticket was mentioned in Slack in #core-privacy by desrosj. View the logs.
8 years ago
#3
@
8 years ago
- Keywords needs-unit-tests added
44550.1.diff is a different approach that I like better. It utilizes code already in wp-login.php that detects the wp_lang URL parameter. This is utilized for all of the other screens (password reset, password change, log out, etc.) on wp-login.php. It also uses restore_previous_locale() instead of restore_current_locale(). The latter restores the original locale and removes any switching history, but the former only reverts the most recent switch.
Tests for this need to be added after or as a part of #43985 (depending which is committed first), as that ticket adds tests for the entire wp_send_user_request() function.
#5
@
8 years ago
- Keywords needs-unit-tests removed
44550.3.diff adds unit tests and adds consideration for when the user has specifically chosen a locale and always adds the wp_lang URL parameter in that scenario (even if it is the same as the site's locale). This ensures that if a user selects a preferred language, it will persist on the confirmation page even if the site's locale changes.
#6
follow-up:
↓ 7
@
8 years ago
Thank you @desrosj
Modifying the confirmation url seems to be relevant approach for this one.
Whether to include the locale info in the confirmation url:
- Unregistered users (uses site's locale): No
- Registered users, with locale set: Yes
- Registered users, without locale set (fallback as site's locale): No
I think this is contained in the tests in 44550.3.diff, that run successfully through phpunit on my install.
The confirmaction page in cases 1) and 3) follows any changes made on the site's locale.
An edge cases for 2): A registered user changes to locale Y, after receiving an email containing the confirmation url with a previous locale X.
I've not checked, but wonder if the user from 2) is logged in, if that should override the wp_lang value in the confirmation url. Maybe it is so?
#7
in reply to: ↑ 6
;
follow-up:
↓ 9
@
8 years ago
Replying to birgire:
An edge cases for 2): A registered user changes to locale Y, after receiving an email containing the confirmation url with a previous locale X.
I don't think that can be prevented unless we look up the locale for the request's user when the page is visited. But because the user would not be logged in at that point, I don't know that it should.
This ticket was mentioned in Slack in #core-privacy by desrosj. View the logs.
8 years ago
#9
in reply to: ↑ 7
@
8 years ago
Replying to desrosj:
Replying to birgire:
An edge cases for 2): A registered user changes to locale Y, after receiving an email containing the confirmation url with a previous locale X.
I don't think that can be prevented unless we look up the locale for the request's user when the page is visited. But because the user would not be logged in at that point, I don't know that it should.
In this case if the user is logged out we can't determine that they changed their locale so would make sense to use the locale supplied in the emailed URL.
Replying to birgire:
I've not checked, but wonder if the user from 2) is logged in, if that should override the wp_lang value in the confirmation url. Maybe it is so?
But as mentioned in the case the user is logged in when they land on the confirmaction page then a check can be made against their current locale which I feel makes sense to override the language set on the URL.
#10
@
8 years ago
I did not realize that the wp-login.php screen actually set up the current user if a user was logged in. I just did some testing, and this is true. TIL.
The patch could be changed to something like the following:
if ( is_user_logged_in() ) {
$lang = get_user_locale();
} elseif ( ! empty( $_GET['wp_lang'] ) ) {
sanitize_text_field( $_GET['wp_lang'] );
}
This would also affect other wp-login.php pages, though (login form, forgotten password, etc.).
An edge case I can think of with this is when user A does not log out properly and user B visits the login screen. If user A uses a different locale than the site default, user B may be unable to use the page. There is #14949 which would redirect the user to the admin when they visit the login screen and are already logged in. This ticket would eliminate that edge case.
I am leaning towards a new ticket using the logged in user's locale on wp-login.php so that each scenario where a logged in user can access wp-login.php can be evaluated.
This ticket was mentioned in Slack in #core by desrosj. View the logs.
8 years ago
This ticket was mentioned in Slack in #core-privacy by desrosj. View the logs.
8 years ago
This ticket was mentioned in Slack in #core-privacy by desrosj. View the logs.
8 years ago
This ticket was mentioned in Slack in #core-privacy by webdevlaw. View the logs.
8 years ago
This ticket was mentioned in Slack in #core-privacy by garrett-eclipse. View the logs.
7 years ago
This ticket was mentioned in Slack in #core by david.baumwald. View the logs.
6 years ago
This ticket was mentioned in Slack in #core by david.baumwald. View the logs.
6 years ago
#22
@
6 years ago
- Milestone 5.5 → Future Release
This ticket hasn't seen any movement this cycle, so it's being moved to Future Release. If any maintainer or committer feels this can be resolved in time or wishes to assume ownership during a specific cycle, feel free to update the milestone.
#23
@
9 months ago
- Keywords needs-testing removed
As @desrosj mentioned above, a refresh is needed, and I will be removing the needs-testing. Waiting for a refresh to retest.
This ticket was mentioned in PR #15717 on WordPress/wordpress-develop by @sawf1y.
43 hours ago
#24
- Keywords has-unit-tests added; needs-refresh removed
Description
When a registered user has selected a locale on their profile, the privacy request confirmation email is sent in that locale (#43985), but the "User action confirmed" page they land on after clicking the link (wp-login.php?action=confirmaction) is shown in the site's locale.
This PR adds the user's selected locale to the confirmation URL as wp_lang. determine_locale() already uses wp_lang on wp-login.php, so the confirmation page now matches the email's language.
wp_lang is added only when the request belongs to a registered user who has explicitly chosen a locale, even if it's the same as the site's locale. That way the page keeps the user's language if the site locale changes later. Unregistered requesters and users on "Site Default" get the same URL as before and follow the site locale.
This refreshes 44550.3.diff against current trunk:
- The
wp-login.phpchange is dropped. Theconfirmactionhandler no longer switches locales, anddetermine_locale()handleswp_langitself. - The URL is built from
$request->confirm_key(#44940). - Test assertions are updated to
assertStringContainsString()/assertStringNotContainsString().
Trac ticket
Testing Instructions
- Install a second language (e.g. Deutsch) in Settings → General, keeping the site language as English.
- Set a test user's profile Language to Deutsch.
- Go to Tools → Export Personal Data, add a request for that user, and send the confirmation email.
- The link in the email should end with
&wp_lang=de_DE. Open it in a logged-out window. The "User action confirmed" page should appear in German. - Repeat with an unregistered email address and with a user whose language is "Site Default". Neither link should contain
wp_lang, and the page should use the site language.
Unit tests: npm run test:php -- --filter wpSendUserRequest
Use of AI Tools
AI assistance: Yes
Tool(s): Claude (Anthropic)
Model(s): Opus 5.5
Used for: Patch refresh and test updates were drafted with AI and reviewed and tested locally by me. AI generated description to PR
#25
follow-up:
↓ 26
@
33 hours ago
- Keywords needs-testing added
Hey @sawf1y, thank you for refreshing the patch.
It seems you have two identical patches. One, would have been just fine.😅
I find working on GitHub much easier (applying patches from Trac is a hassle now), so I would suggest that the committers and testers use the PR instead.
Updating keywords by adding needs-testing after the patch refresh.
#26
in reply to: ↑ 25
@
25 hours ago
Replying to r1k0:
It seems you have two identical patches. One, would have been just fine.😅
So, if I’ve submitted a PR, I don’t need to upload a separate patch to the ticket? Good to know. I’ve always done that—I usually add a patch to the ticket for the tester's convenience. If it’s unnecessary, I’ll stop doing it.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
44550.diff will display the confirmation page in the locale of the user.
To test:
en_US(default).en_USselected when the site's locale is not the default.