Making WordPress.org

Changeset 2465


Ignore:
Timestamp:
02/04/2016 05:51:37 PM (9 years ago)
Author:
stephdau
Message:

WPORG SSO: filtering the lost password URL to make sure to always point to our custom route/template.

See #1524

File:
1 edited

Legend:

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

    r2336 r2465  
    1717         */
    1818        public $valid_sso_paths = array(
    19             '/',
    20             '/checkemail',
    21             '/loggedout',
    22             '/lostpassword',
    23             '/oauth',
     19            'root'         => '/',
     20            'checkemail'   => '/checkemail',
     21            'loggedout'    => '/loggedout',
     22            'lostpassword' => '/lostpassword',
     23            'oauth'        => '/oauth',
    2424        );
    2525       
     
    5454            // Add our host to the list of allowed ones.
    5555            add_filter( 'allowed_redirect_hosts', array( &$this, 'add_allowed_redirect_host' ) );
     56           
     57            // Replace the lost password URL by our own
     58            add_filter( 'lostpassword_url', array( &$this, 'lostpassword_url' ), 10, 2 );
    5659           
    5760            if ( preg_match( '!/wp-signup\.php$!', $this->script ) ) {
     
    167170       
    168171        /**
     172         * Filters the default lost password URL and returns our custom one instead.
     173         *
     174         * @param string $lostpassword_url
     175         * @param string $redirect
     176         */
     177        public function lostpassword_url( $lostpassword_url, $redirect ) {
     178            return home_url( $this->valid_sso_paths['lostpassword'] . '/?redirect_to=' . $redirect );
     179        }
     180       
     181        /**
    169182         * Redirects the user to her/his (support) profile.
    170183         */
Note: See TracChangeset for help on using the changeset viewer.