diff --git a/10up-experience.php b/10up-experience.php index 8bf3037..0a3fee7 100644 --- a/10up-experience.php +++ b/10up-experience.php @@ -3,7 +3,7 @@ * Plugin Name: 10up Experience * Plugin URI: https://github.com/10up/10up-experience * Description: The 10up Experience plugin configures WordPress to better protect and inform clients, aligned to 10up’s best practices. - * Version: 1.12.1 + * Version: 1.13.0 * Author: 10up * Author URI: https://10up.com * License: GPLv2 or later @@ -19,7 +19,7 @@ use YahnisElsts\PluginUpdateChecker\v5\PucFactory; -define( 'TENUP_EXPERIENCE_VERSION', '1.12.1' ); +define( 'TENUP_EXPERIENCE_VERSION', '1.13.0' ); define( 'TENUP_EXPERIENCE_DIR', __DIR__ ); define( 'TENUP_EXPERIENCE_FILE', __FILE__ ); diff --git a/CHANGELOG.md b/CHANGELOG.md index 739c9b7..252349f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file, per [the Keep a Changelog standard](http://keepachangelog.com/). +## [1.13.0] - 2024-12-09 + +* Turn on Fueled SSO by default +* Convert users to @fueled.com emails + + ## [1.12.1] - 2024-09-24 - Add filter for allowlisting specific API routes `tenup_experience_rest_api_allowlist` diff --git a/includes/classes/SSO/SSO.php b/includes/classes/SSO/SSO.php index d34e28b..97109bf 100644 --- a/includes/classes/SSO/SSO.php +++ b/includes/classes/SSO/SSO.php @@ -228,9 +228,26 @@ public function process_client_login() { $user_id = false; $user = get_user_by( 'email', $email ); - if ( ! $user ) { - $short_email = str_replace( '@get10up.com', '@10up.com', $email ); - $user = get_user_by( 'email', $short_email ); + + if ( ! $user && preg_match( '#@fueled\.com$#i', $email ) ) { + // Check if fueled person had a 10up email + $old_10up_email = str_replace( '@fueled.com', '@get10up.com', $email ); + $tenup_user = get_user_by( 'email', $old_10up_email ); + + if ( $tenup_user ) { + // Turn off email change notification + add_filter( 'send_email_change_email', '__return_false' ); + + // Update tenup user to use fueled email + wp_update_user( + array( + 'ID' => $tenup_user->ID, + 'user_email' => $email, + ) + ); + + $user = get_user_by( 'id', $tenup_user->ID ); + } } if ( ! $user ) { @@ -350,10 +367,8 @@ public function update_login_form() { $buttons_html .= '' . 'Login'; - if ( defined( 'TENUPSSO_ALLOW_FUELED_SSO' ) && TENUPSSO_ALLOW_FUELED_SSO ) { - $buttons_html .= '' . - 'Login'; - } + $buttons_html .= '' . + 'Login'; $buttons_html .= 'or'; $buttons_html .= '';