Plugin Directory

Changeset 3790914


Ignore:
Timestamp:
11/08/2026 11:35:50 AM (less than one hour ago)
Author:
deadko
Message:

Release 1.0.4

Location:
tso-login-organizer/trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • tso-login-organizer/trunk/includes/tsolo-actions.php

    r3788843 r3790914  
    582582        tsolo_set_errors( $errors );
    583583
    584         if ( $reauth ) {
     584        // wp-admin sends visitors here with reauth=1 whenever it cannot validate the auth cookie. When it was
     585        // opened on another host (e.g. non-www) than the one that holds the session, the session on THIS host
     586        // is still valid: do not wipe it, or one stray admin link logs the user out. Same-host reauth keeps
     587        // the standard behaviour (clear the cookies so the login form is shown again).
     588        $request_host = isset( $_SERVER['HTTP_HOST'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized above.
     589        $cross_host   = tsolo_reauth_is_cross_host_bounce( $redirect_to, $request_host );
     590        if ( tsolo_reauth_should_clear_auth_cookie( $reauth, is_user_logged_in(), $cross_host ) ) {
    585591                wp_clear_auth_cookie();
    586592        }
    … …  
    589595                tsolo_send_ajax_error( array( 'errors' => tsolo_render_errors_html( $errors ) ) );
    590596        }
     597}
     598
     599/**
     600 * Whether a reauth=1 request is a bounce from wp-admin opened on another host (e.g. non-www).
     601 *
     602 * @param string $redirect_to  redirect_to request value (the wp-admin URL that bounced).
     603 * @param string $request_host Host of the current (login page) request.
     604 * @return bool True only when both hosts are known and differ (port ignored).
     605 */
     606function tsolo_reauth_is_cross_host_bounce( $redirect_to, $request_host ) {
     607        $target = wp_parse_url( (string) $redirect_to, PHP_URL_HOST );
     608        $here   = preg_replace( '/:\d+$/', '', strtolower( (string) $request_host ) );
     609        if ( ! is_string( $target ) || '' === $target || '' === $here ) {
     610                return false;
     611        }
     612        return strtolower( $target ) !== $here;
     613}
     614
     615/**
     616 * Whether the login page must clear the auth cookies on a reauth=1 request.
     617 *
     618 * Clears like WordPress core, except when the visitor already has a valid session on this host and
     619 * wp-admin bounced from a different host: that session is fine and must be kept.
     620 *
     621 * @param bool $reauth     Whether reauth was requested.
     622 * @param bool $logged_in  Whether the visitor has a valid session on this host.
     623 * @param bool $cross_host Whether the bounce came from another host.
     624 * @return bool
     625 */
     626function tsolo_reauth_should_clear_auth_cookie( $reauth, $logged_in, $cross_host = false ) {
     627        return (bool) $reauth && ! ( $logged_in && $cross_host );
    591628}
    592629
  • tso-login-organizer/trunk/readme.txt

    r3789986 r3790914  
    66Tested up to: 7.1
    77Requires PHP: 7.4
    8 Stable tag: 1.0.3
     8Stable tag: 1.0.4
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    102102== Changelog ==
    103103
     104= 1.0.4 =
     105* Fix: opening wp-admin on another host (for example without "www") no longer logs you out; the login page keeps a session that is still valid.
     106
    104107= 1.0.3 =
    105108* Improvement: avatars no longer repeat the same database lookup for commenters' emails on every avatar.
    … …  
    131134* Front: widgets no longer get extra bottom spacing on mobile, 2FA backup codes wrap and social buttons are easier to tap.
    132135
    133 = 1.0.1 =
    134 * Two-factor: wrong codes are limited, a code cannot be reused, XML-RPC needs an application password and the code field also shows on wp-login.php.
    135 * Security: old lockout attempts are purged, and Hide wp-login.php no longer blocks when the plugin login page is not reachable.
    136 * Profile: the current password is needed to change email, password or turn two-factor off.
    137 * Password reset: an empty password now shows an error.
    138 * Social login and email confirmation: clear message when cancelled or when the link is invalid.
    139 * Module settings keep the line breaks of email texts.
    140 * Avatars use random file names and are removed when the user is deleted.
    141 * Secret keys are masked in the settings screen.
    142 * Default role can only be set to a role the admin may assign.
    143 * Uninstall also removes the new two-factor and restriction data.
    144 * Uninstall keeps your data unless "Delete all plugin data" is ticked in Core settings.
    145 * Security: choose the visitor IP source (Cloudflare, X-Forwarded-For, X-Real-IP) and list IPs that are never locked out.
    146 * Two-factor: users of a role that requires it are kept on their profile until they enable it.
    147 * Restrictions: the role box is available on every public post type and restricted content is blocked completely (login redirect or 403).
    148 * Email confirmation links expire after 48 hours and a new link is sent automatically; approved users get an email.
    149 * Social login: administrator accounts are never linked by email and the requested redirect is kept.
    150 * Captcha: new filter tsolo_captcha_fail_open for provider outages.
    151 * Mailchimp subscriptions run in the background so registration is not delayed.
    152 * Avatars are resized to 256 px.
    153 * Reserved page slugs are refused and page lookups are cached.
    154 * Favorites: the button recovers by itself when a cached page has an expired security token.
    155 
    156 = 1.0.0 =
    157 * First plugin version.
     136See changelog.txt in the plugin folder for older versions.
  • tso-login-organizer/trunk/tso-login-organizer.php

    r3789986 r3790914  
    33 * Plugin Name:       TSO Login Organizer
    44 * Description:       Your own login, registration and password-reset pages inside your site, instead of wp-login.php, plus optional 2FA, security and social login.
    5  * Version:           1.0.3
     5 * Version:           1.0.4
    66 * Author:            Tu Soporte Online
    77 * Author URI:        https://www.tusoporteonline.es/blog
    … …  
    2626
    2727if ( ! defined( 'TSOLO_VERSION' ) ) {
    28         define( 'TSOLO_VERSION', '1.0.3' );
     28        define( 'TSOLO_VERSION', '1.0.4' );
    2929}
    3030
Note: See TracChangeset for help on using the changeset viewer.