WordPress.org

Making WordPress.org

Changeset 2323


Ignore:
Timestamp:
01/19/16 16:14:28 (2 years ago)
Author:
stephdau
Message:

WordPress.org SSO: updating theme with a patyh router/validator.

See #1524, and r2322

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/index.php

    r2313 r2323  
    88get_header(); 
    99 
    10 if ( ! empty( $_GET['screen'] ) ) { 
    11     $screen = preg_replace( '/[^a-z0-9-]/', '', $_GET['screen'] ); 
    12 } else if ( preg_match( '/^\/oauth([\/\?]{1}.*)?$/', $_SERVER['REQUEST_URI'] ) ) { 
    13     $screen = 'oauth'; 
     10/** 
     11 * Test if the path we're on is one that we use, depending on if it 
     12 * has a partial or not, or load the 404 partial as fallback. 
     13 *  
     14 * Note that the path is first validated in WP_WPOrg_SSO::redirect_all_login_or_signup_to_sso(). 
     15 * @see https://meta.trac.wordpress.org/browser/sites/trunk/common/includes/wporg-sso/wp-plugin.php 
     16 */ 
     17 
     18if ( apply_filters( 'is_valid_wporg_sso_path', false ) && preg_match( '!^(/[^/\?]*)([/\?]{1,2}.*)?$!', $_SERVER['REQUEST_URI'], $matches ) ) { 
     19    $screen = '/' === $matches[1] ? 'login' : preg_replace( '/[^a-z0-9-]/', '', $matches[1] ); 
    1420} else { 
    15     $screen = 'login'; 
     21    $screen = '404'; 
    1622} 
    1723 
    18 $partial = __DIR__ . '/partials/' . $screen . '.php'; 
     24$partials_dir = __DIR__ . '/partials/'; 
     25$partial      = $partials_dir . $screen . '.php'; 
    1926 
    2027if ( file_exists( $partial ) ) { 
    2128    require_once( $partial ); 
     29} else { 
     30    require_once( $partials_dir . '404.php'); 
    2231} 
    2332 
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/partials/login.php

    r2308 r2323  
    22 
    33<p class="nav"> 
    4     <a href="/?screen=lostpassword" title="<?php _e( 'Password Lost and Found', 'wporg-login' ); ?>"><?php _e( 'Forgot password?', 'wporg-login' ); ?></a> &nbsp; • &nbsp;  
     4    <a href="/lostpassword/" title="<?php _e( 'Password Lost and Found', 'wporg-login' ); ?>"><?php _e( 'Forgot password?', 'wporg-login' ); ?></a> &nbsp; • &nbsp;  
    55    <a href="https://wordpress.org/support/register.php" title="<?php _e( 'Create an account', 'wporg-login' ); ?>"><?php _e( 'Create an account', 'wporg-login' ); ?></a> 
    66</p> 
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/partials/lostpassword.php

    r2308 r2323  
    66        <input type="text" name="user_login" id="user_login" value="" size="20"></label> 
    77    </p> 
    8     <input type="hidden" name="redirect_to" value="/?screen=checkemail"> 
     8    <input type="hidden" name="redirect_to" value="/checkemail/"> 
    99    <p class="submit"> 
    1010        <input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e( 'Get new password', 'wporg-login' ); ?>"> 
Note: See TracChangeset for help on using the changeset viewer.