Make WordPress Core

Opened 8 years ago

Closed 15 months ago

Last modified 14 months ago

#40762 closed enhancement (fixed)

Login: add canonical admin shorthand URL for login.php

Reported by: lancewillett's profile lancewillett Owned by: audrasjb's profile audrasjb
Milestone: 6.4 Priority: normal
Severity: minor Version: 4.8
Component: Login and Registration Keywords: has-patch has-testing-info needs-testing
Focuses: Cc:

Description

Users could type login.php by accident when trying to access their admin dashboard because wp-login.php is a known URL and shorthand, and either they don't remember or get it wrong.

Let's make that more friendly.

Right now WordPress treats it as a 404, and tries to redirect it to a valid permalink if it's available.

It'd be more user-friendly to automatically send to login page, or admin if logged in.

Attachments (2)

40762.diff (406 bytes) - added by lancewillett 8 years ago.
40762.2.diff (427 bytes) - added by tejwanihemant 16 months ago.

Download all attachments as: .zip

Change History (24)

@lancewillett
8 years ago

#1 @subrataemfluence
8 years ago

Good suggestion!

Your patch works fine as far as taking user to login page with login.php.

However, the problem I found (not in your code, it works perfectly fine) is WordPress takes me to login page even if I am already logged in! I should rather be on some other page but of course not on login page.

Added a proposed patch at #40768 to prevent this.

#2 @SergeyBiryukov
16 months ago

  • Milestone changed from Awaiting Review to 6.4

This seems like a nice little enhancement, moving for 6.4 consideration.

#3 @tejwanihemant
16 months ago

Added refreshed patch.

#4 @oglekler
16 months ago

  • Keywords needs-testing added

Some plugins are used to change wp-login.php to /login/
I assume that it needs to be tested that this enhancement has no side effects and will not break this logic.

This ticket was mentioned in Slack in #core by oglekler. View the logs.


15 months ago

#6 @Ankit K Gupta
15 months ago

Test Report ✅

Env

  • WordPress - 6.4-alpha-20230914.125438
  • Chrome Version - Version 116
  • OS - macOS Monterey V12.3.1
  • Theme: Storefront Version: 4.2.0
  • PHP - 7.4.0
  • Web Server - Apache
  • Database - MySQL 5.7.28

Test result

Tested the patch and the patch works fine.

After the patch:

'http://example.com/login.php' redirects to 'http://example.com/wp-login.php'

'http://example.com/login' redirects to 'http://example.com/wp-login.php'

Also checked on sub-domain sites like

'http://example.com/tester/login.php' redirects to 'http://example.com/tester/wp-login.php'

Video Demostration:

https://www.loom.com/share/876864d1d47f4022b86ef21631f94afb

#7 @Ankit K Gupta
15 months ago

  • Keywords has-testing-info added; needs-testing removed

#8 @devmuhib
15 months ago

Test Report

This report validates that the indicated patch addresses the issue.

Patch tested: REPLACE_WITH_PATCH_URL

Environment

  • WordPress: 6.3.1
  • PHP: 8.1.10
  • Server: Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10
  • Database: mysqli (Server: 8.0.30 / Client: mysqlnd 8.1.10)
  • Browser: Chrome 116.0.0.0 (Windows 10/11)
  • Theme: Twenty Twenty-Three 1.2
  • MU-Plugins: None activated
  • Plugins:
    • WordPress Beta Tester 3.5.4

Actual Results

  • ✅ Issue resolved with patch.

Additional Notes

  • I just tested the patch and it's working fine. Added the video and screenshots.

After Patch Tested

Screenshot: https://i.imgur.com/jGMG9M7.jpeg
Video : https://youtu.be/Deodp7VS7UE

#9 @oglekler
15 months ago

  • Keywords commit added

This is simple enough patch, and it has been tested, so, I am marking this for review to commit.

#10 @audrasjb
15 months ago

  • Owner set to audrasjb
  • Status changed from new to reviewing

Self assigning for final review and commit.

#11 follow-up: @audrasjb
15 months ago

  • Keywords dev-feedback added; commit removed

The patch looks simple, straightforward, but I'm wondering whether we should also add
site_url( 'login.php', 'relative' ) for multisite support.

This ticket was mentioned in Slack in #core by oglekler. View the logs.


15 months ago

#13 @tejwanihemant
15 months ago

The provided patch is also compatible with multisite support.

This ticket was mentioned in Slack in #core by oglekler. View the logs.


15 months ago

#15 @oglekler
15 months ago

  • Keywords commit added

This ticket was discussed during bug scrub,
and it was decided that concern is addressed and mark the ticket for review to commit.

Thank to @hellofromtonya and @joemcgill

Last edited 15 months ago by oglekler (previous) (diff)

#16 in reply to: ↑ 11 @hellofromTonya
15 months ago

  • Keywords dev-feedback removed

Replying to audrasjb:

The patch looks simple, straightforward, but I'm wondering whether we should also add
site_url( 'login.php', 'relative' ) for multisite support.

As discussed during yesterday's scrub, it should be okay to commit the patch ahead of Beta 1 following @tejwanihemant reply (see comment:13).

I'll remove dev-feedback keyword. However, if additional consideration is needed as noted by @audrasjb, the ticket can be reopened for a follow-up commit.

40762.2.diff is ready for commit consideration.

#17 @hellofromTonya
15 months ago

  • Keywords needs-testing added; commit removed

Test Report

This report validates that the indicated patch addresses the issue.

Patch tested: https://core.trac.wordpress.org/attachment/ticket/40762/40762.2.diff

Environment

  • WordPress: 6.4-alpha-56267-src
  • Localhost: Docker wp-env
  • Browser: Chrome and Firefox
  • Theme: Twenty Twenty-Three
  • MU-Plugins: None activated
  • Plugins: None activated

Actual Results

I can reproduce the reported issue.

However, the patch does not resolve the 404 for me ❌ It still is a 404.

#18 follow-up: @hellofromTonya
15 months ago

  • Milestone changed from 6.4 to 6.5

Beta 1 starts in ~40 minutes. As the patch did not work for me, I think this ticket needs more time for discussion and testing. Moving it to 6.5.

#19 @SergeyBiryukov
15 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 56718:

Login and Registration: Add /login.php as an alias for the login page.

This aims to make the login process more user-friendly.

Follow-up to [19875], [19880].

Props lancewillett, subrataemfluence, tejwanihemant, ankit-k-gupta, devmuhib, audrasjb, hellofromTonya, joemcgill.
Fixes #40762.

#20 @hellofromTonya
15 months ago

  • Milestone changed from 6.5 to 6.4

With commit [56718], moving this back into 6.4.

Hmm, wonder why the fix does not working for me.

#21 in reply to: ↑ 18 @SergeyBiryukov
15 months ago

Replying to hellofromTonya:

As the patch did not work for me, I think this ticket needs more time for discussion and testing. Moving it to 6.5.

Ah, I missed the latest comments. However, it appears to work for me, and there are two successful test reports above.

It is worth noting that the wp_redirect_admin_locations() function requires permalinks to be enabled, maybe that could be the reason? We can reopen the ticket to add some tests.

#22 @rajinsharwar
14 months ago

Not sure if this is related, but can you please check if flushing the permalinks helps @hellofromTonya? I can try testing this thing out within some days, and maybe we can reopen this if there were some edge cases missed.

Last edited 14 months ago by rajinsharwar (previous) (diff)
Note: See TracTickets for help on using tickets.