fix: auto-login after checkout, ThankYou guest buttons, forgot password page

1. Auto-login after checkout:
   - Added wp_set_auth_cookie() and wp_set_current_user() in CheckoutController
   - Auto-registered users are now logged in when thank-you page loads

2. ThankYou page guest buttons:
   - Added 'Login / Create Account' button for guests
   - Shows for both receipt and basic templates
   - No more dead-end after placing order as guest

3. Forgot password flow:
   - Created ForgotPassword page component (/forgot-password route)
   - Added forgot_password API endpoint in AuthController
   - Uses WordPress retrieve_password() for reset email
   - Replaced wp-login.php link in Login page
This commit is contained in:
Dwindi Ramadhana
2026-01-01 17:36:40 +07:00
parent 62f25b624b
commit 78d7bc1161
7 changed files with 239 additions and 7 deletions

View File

@@ -16,6 +16,7 @@ import ThankYou from './pages/ThankYou';
import Account from './pages/Account';
import Wishlist from './pages/Wishlist';
import Login from './pages/Login';
import ForgotPassword from './pages/ForgotPassword';
// Create QueryClient instance
const queryClient = new QueryClient({
@@ -85,8 +86,9 @@ function AppRoutes() {
{/* Wishlist - Public route accessible to guests */}
<Route path="/wishlist" element={<Wishlist />} />
{/* Login */}
{/* Login & Auth */}
<Route path="/login" element={<Login />} />
<Route path="/forgot-password" element={<ForgotPassword />} />
{/* My Account */}
<Route path="/my-account/*" element={<Account />} />