Making WordPress.org

Changeset 6676


Ignore:
Timestamp:
02/17/2018 12:14:14 PM (7 years ago)
Author:
ocean90
Message:

WordPress.org SSO: Don't append the current locale if on SSO host.

See #1673.

Location:
sites/trunk/common/includes/wporg-sso
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/common/includes/wporg-sso/class-wporg-sso.php

    r4964 r6676  
    4141        */
    4242        public function add_allowed_redirect_host( $hosts ) {
    43             if ( self::SSO_HOST === $this->host ) {
     43            if ( $this->is_sso_host() ) {
    4444                // If on the SSO host, add the requesting source (eg: make.wordpress.org), if within our bounds
    4545                $url  = parse_url( $this->_get_safer_redirect_to() );
     
    8989        public function has_host() {
    9090            return ( ! empty( $this->host ) );
     91        }
     92
     93        /**
     94         * Whether the current host is the SSO host.
     95         *
     96         * @return bool True if current host is the SSO host, false if not.
     97         */
     98        public function is_sso_host() {
     99            return self::SSO_HOST === $this->host;
    91100        }
    92101
  • sites/trunk/common/includes/wporg-sso/wp-plugin.php

    r6661 r6676  
    5555                add_filter( 'pre_site_option_registration', array( $this, 'inherit_registration_option' ) );
    5656
    57                 add_filter( 'login_url', [$this, 'add_locale'], 21 );
    58                 add_filter( 'register_url', [$this, 'add_locale'], 21 );
    59                 add_filter( 'lostpassword_url', [$this, 'add_locale'], 21 );
     57                if ( ! $this->is_sso_host() ) {
     58                    add_filter( 'login_url', [ $this, 'add_locale' ], 21 );
     59                    add_filter( 'register_url', [ $this, 'add_locale' ], 21 );
     60                    add_filter( 'lostpassword_url', [ $this, 'add_locale' ], 21 );
     61                }
    6062            }
    6163        }
     
    162164                $this->_safe_redirect( add_query_arg( 'redirect_to', urlencode( $redirect_req ), $this->sso_signup_url ) );
    163165
    164             } elseif ( self::SSO_HOST !== $this->host ) {
     166            } elseif ( ! $this->is_sso_host() ) {
    165167                // If we're not on the SSO host
    166168                if ( preg_match( '!/wp-login\.php$!', $this->script ) ) {
Note: See TracChangeset for help on using the changeset viewer.