WordPress.org

Making WordPress.org

Changeset 4120


Ignore:
Timestamp:
09/23/2016 05:40:45 PM (3 years ago)
Author:
ocean90
Message:

WordPress.org SSO: Add /logout path.

This path is used for non-WordPress systems like Trac. It displays an "Are You Sure" message to confirm the logout action.

See #2029.

Location:
sites/trunk
Files:
1 added
1 edited

Legend:

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

    r4118 r4120  
    4848                // Not in list of targeted domains, not interested, bail out
    4949                return;
     50            }
     51
     52            // Extend paths which are only available for logged in users.
     53            if ( is_user_logged_in() ) {
     54                $this->valid_sso_paths['logout'] = '/logout';
    5055            }
    5156
     
    117122                            }
    118123                        } else if ( is_user_logged_in() ) {
    119                             // Otherwise, redirect to the login screen.
    120                             $this->_redirect_to_profile();
     124                            if ( preg_match( '!^' . $this->valid_sso_paths['logout'] . '/?$!', $_SERVER['REQUEST_URI'] ) ) {
     125                                // No redirect, ask the user if they really want to log out.
     126                                return;
     127                            } else {
     128                                // Otherwise, redirect to the login screen.
     129                                $this->_redirect_to_profile();
     130                            }
    121131                        }
    122132                    } elseif ( is_user_logged_in() ) {
Note: See TracChangeset for help on using the changeset viewer.