fix: use SPA page (store) for reset password URL
Changed from /my-account to /store page URL: - Now reads spa_page from woonoow_appearance_settings - Uses get_permalink() on the configured SPA page ID - Fallback to home_url if SPA not configured - Reset URL format: /store/#/reset-password?key=...&login=...
This commit is contained in:
@@ -327,19 +327,21 @@ class EmailManager {
|
||||
return $message; // Use WordPress default
|
||||
}
|
||||
|
||||
// Build reset URL - use customer-facing SPA route on my-account page
|
||||
// The my-account page loads the customer-spa which has the reset-password route
|
||||
$myaccount_page_id = function_exists('wc_get_page_id') ? wc_get_page_id('myaccount') : 0;
|
||||
if ($myaccount_page_id > 0) {
|
||||
$myaccount_url = get_permalink($myaccount_page_id);
|
||||
// Build reset URL - use SPA page from appearance settings
|
||||
// The SPA page (e.g., /store/) loads customer-spa which has /reset-password route
|
||||
$appearance_settings = get_option('woonoow_appearance_settings', []);
|
||||
$spa_page_id = $appearance_settings['general']['spa_page'] ?? 0;
|
||||
|
||||
if ($spa_page_id > 0) {
|
||||
$spa_url = get_permalink($spa_page_id);
|
||||
} else {
|
||||
// Fallback to home URL if my-account page doesn't exist
|
||||
$myaccount_url = home_url('/');
|
||||
// Fallback to home URL if SPA page not configured
|
||||
$spa_url = home_url('/');
|
||||
}
|
||||
|
||||
// Build SPA reset password URL with hash router format
|
||||
// Format: /my-account/#/reset-password?key=KEY&login=LOGIN
|
||||
$reset_link = rtrim($myaccount_url, '/') . '#/reset-password?key=' . $key . '&login=' . rawurlencode($user_login);
|
||||
// Format: /store/#/reset-password?key=KEY&login=LOGIN
|
||||
$reset_link = rtrim($spa_url, '/') . '#/reset-password?key=' . $key . '&login=' . rawurlencode($user_login);
|
||||
|
||||
// Create a pseudo WC_Customer for template rendering
|
||||
$customer = null;
|
||||
|
||||
Reference in New Issue
Block a user