Changeset 2158
- Timestamp:
- 12/03/2015 07:05:19 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/common/includes/wporg-sso/wp-plugin.php
r2150 r2158 65 65 add_action( 'login_url', array( &$this, 'login_url' ), 10, 2 ); 66 66 } 67 } else if ( self::SSO_HOST === $this->host && ! preg_match( '/\/wp-login\.php$/', $this->script ) ) { 68 // If on the SSO host, but not on its login or signup screen. 69 // TODO: Relax rules when we want more out of our theme then bypassing it altogether with redirects. 70 if ( is_user_logged_in() ) { 71 // Mimic what happens after a login without a specified redirect. 72 $this->_safe_redirect( 'https://wordpress.org/support/profile/' . get_currentuserinfo()->user_login ); 67 } else if ( self::SSO_HOST === $this->host ) { 68 // If on the SSO host 69 if ( ! preg_match( '/\/wp-login\.php$/', $this->script ) ) { 70 // ... but not on its login or signup screen. 71 // TODO: Relax rules when we want more out of our theme then bypassing it altogether with redirects. 72 if ( is_user_logged_in() ) { 73 // Mimic what happens after a login without a specified redirect. 74 $this->_safe_redirect( 'https://wordpress.org/support/profile/' . get_currentuserinfo()->user_login ); 75 } else { 76 // Otherwise, redirect to the login screen. 77 $this->_safe_redirect( $this->sso_login_url ); 78 } 73 79 } else { 74 // Otherwise, redirect to the login screen.75 $this->_safe_redirect( $this->sso_login_url);80 // if on login screen, filter network_site_url to make sure our forms go to the SSO host, not wordpress.org 81 add_action( 'network_site_url', array( &$this, 'login_network_site_url' ), 10, 3 ); 76 82 } 77 83 } 84 } 85 86 /** 87 * Modifies the network_site_url on login.wordpress.org's login screen to make sure all forms and links 88 * go to the SSO host, not wordpress.org 89 * 90 * @param string $url 91 * @param string $path 92 * @param string $scheme 93 * @return string 94 * 95 * @example add_action( 'network_site_url', array( &$this, 'login_network_site_url' ), 10, 3 ); 96 */ 97 public function login_network_site_url( $url, $path, $scheme ) { 98 if ( self::SSO_HOST === $this->host && preg_match( '/\/wp-login\.php$/', $this->script ) ) { 99 $url = preg_replace( '/^(https?:\/\/)[^\/]+(\/.+)$/' , '\1login.wordpress.org\2', $url ); 100 } 101 102 return $url; 78 103 } 79 104 }
Note: See TracChangeset
for help on using the changeset viewer.