Changed reset link URL from admin SPA to customer-spa:
- Old: /wp-admin/admin.php?page=woonoow#/reset-password?key=...
- New: /my-account#/reset-password?key=...
This fixes the login redirect issue - the customer-spa is publicly
accessible so users can reset their password without logging in first.
Added:
- customer-spa/src/pages/ResetPassword/index.tsx
- Route /reset-password in customer-spa App.tsx
EmailManager.php now:
- Uses wc_get_page_id('myaccount') to get my-account page URL
- Falls back to home_url if my-account page not found
- Created ResetPassword.tsx with:
- Password reset form with strength indicator
- Key validation on load
- Show/hide password toggle
- Success/error states
- Redirect to login on success
- Updated EmailManager.php:
- Changed reset_link from wp-login.php to SPA route
- Format: /wp-admin/admin.php?page=woonoow#/reset-password?key=KEY&login=LOGIN
- Added AuthController API methods:
- validate_reset_key: Validates reset key before showing form
- reset_password: Performs actual password reset
- Registered new REST routes in Routes.php:
- POST /auth/validate-reset-key
- POST /auth/reset-password
Password reset emails now link to the SPA instead of native WordPress.
🐛 CRITICAL FIX - Root Cause Found:
Problem 1: Events Not Enabled by Default
- is_event_enabled() returned false if not configured
- Required explicit admin configuration
- Plugin didn't work out-of-the-box
Solution:
- Enable email notifications by default if not configured
- Allow plugin to work with default templates
- Users can still disable via admin if needed
Problem 2: Default Templates Not Loading
- EmailRenderer called get_template() with only 2 args
- Missing $recipient_type parameter
- Default template lookup failed
Solution:
- Pass recipient_type to get_template()
- Proper default template lookup
- Added debug logging for template resolution
📝 Changes:
1. EmailManager::is_event_enabled()
- Returns true by default for email channel
- Logs when using default (not configured)
- Respects explicit disable if configured
2. EmailRenderer::get_template_settings()
- Pass recipient_type to TemplateProvider
- Log template found/not found
- Proper default template resolution
🎯 Result:
- Plugin works out-of-the-box
- Default templates used if not customized
- Email notifications sent without configuration
- Users can still customize in admin
✅ Expected Behavior:
1. Install plugin
2. Create order
3. Email sent automatically (default template)
4. Customize templates in admin (optional)
This fixes the issue where check-settings.php showed:
- Email: ✗ NOT CONFIGURED
- Templates: 0
Now it will use defaults and send emails!