[wp-trac] [WordPress Trac] #51642: Better detect `local` environments to enable Application Passwords option showing up on localhost (was: Application Passwords option not showing up on localhost on the user profile page)

WordPress Trac noreply at wordpress.org
Wed Oct 28 13:09:15 UTC 2020


#51642: Better detect `local` environments to enable Application Passwords option
showing up on localhost
----------------------------+------------------------------
 Reporter:  tijmensmit      |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Bootstrap/Load  |     Version:
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:  rest-api
----------------------------+------------------------------
Changes (by georgestephanis):

 * component:  Login and Registration => Bootstrap/Load


Old description:

> A call is made to wp_is_application_passwords_available() in the user-
> edit.php to see if the option should be shown or not. This is true if SSL
> is used, or if the current environment is 'local' according to
> wp_get_environment_type().
>
> On my localhost wp_get_environment_type() returns 'production' while it's
> actually 'local' resulting in the application passwords option not
> showing up ( no SSL available ).
>
> This is the path that shows up in the URL bar in my browser
> 'http://localhost/wordpress56/'
>
> Don't know if it's related, but 'WP_ENVIRONMENT_TYPE' is also empty for
> me, which is checked in the wp_get_environment_type() code.
>
> I'm using xampp with PHP 7.3 and WordPress 5.6 Beta 1 on my local
> machine.

New description:

 A call is made to wp_is_application_passwords_available() in the user-
 edit.php to see if the option should be shown or not. This is true if SSL
 is used, or if the current environment is 'local' according to
 wp_get_environment_type().

 On my localhost wp_get_environment_type() returns 'production' while it's
 actually 'local' resulting in the application passwords option not showing
 up ( no SSL available ).

 This is the path that shows up in the URL bar in my browser
 'http://localhost/wordpress56/'

 Don't know if it's related, but 'WP_ENVIRONMENT_TYPE' is also empty for
 me, which is checked in the wp_get_environment_type() code.

 I'm using xampp with PHP 7.3 and WordPress 5.6 Beta 1 on my local machine.

--

Comment:

 Retooling the title and description slightly to orient toward addressing
 the root concern.  Also see #33161


 cc: @SergeyBiryukov (following your work on the initial ticket) -- any
 thoughts on if there would be negative side effects of integrating the
 (fairly basic) check of "If the `site_url`'s domain is `localhost` or
 `127.0.0.1` or `::1` default it to a `local` environment" -- Other options
 would include if there are no dots in it or the like, but keeping it
 easily understandable seems safer.

 Also, possibly "ignore the constant if it's defined to a value other than
 the four valid options"

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51642#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list