WordPress.org

Making WordPress.org

Changeset 7689


Ignore:
Timestamp:
09/21/2018 06:16:25 AM (2 years ago)
Author:
dd32
Message:

Login: SSO: Correct the login_url() function to properly handle the $redirect_to variable that's passed.

See #3794.

File:
1 edited

Legend:

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

    r6835 r7689  
    6262         * Returns the SSO login URL, with redirect_to as requested, if deemed valid.
    6363         *
    64          * @param string $redirect_to
    65          * @param string $filter_redirect_to When used with the WP login_url filter, the redirect_to is passed as a 2nd arg instead.
     64         * @param string $login_url
     65         * @param string $redirect_to When used with the WP login_url filter, the redirect_to is passed as a 2nd arg instead.
    6666         * @return string
    6767         *
    68          * @example Use directly, or through add_action( 'login_url', array( &$wporg_sso, 'login_url' ), 10, 2 );
     68         * @example Use through add_action( 'login_url', array( $wporg_sso, 'login_url' ), 10, 2 );
    6969         */
    70         public function login_url( $redirect_to = '', $filter_redirect_to = '' ) {
     70        public function login_url( $login_url = '', $redirect_to = '' ) {
    7171            $login_url = $this->sso_login_url;
    72             // If 2nd arg is passed, then redirect_to is it.
    73             if ( ! empty( $filter_redirect_to ) ) {
    74                 $redirect_to = $filter_redirect_to;
    75             }
     72
    7673            if ( ! empty( $redirect_to ) && $this->_is_valid_targeted_domain( $redirect_to ) ) {
    7774                $redirect_to = preg_replace( '/\/wp-(login|signup)\.php\??.*$/', '/', $redirect_to );
    7875                $login_url = add_query_arg( 'redirect_to', urlencode( $redirect_to ), $login_url );
    7976            }
     77
    8078            return $login_url;
    8179
Note: See TracChangeset for help on using the changeset viewer.