How the Login Works
- Customer enters their purchase email
- The form POSTs to
/api/check-order - The API looks up all purchase conversions for that email
- If orders are found, the session is hydrated with customer data and the user is redirected
- If no orders are found, an error message is shown
Customers who just completed a purchase are already logged in — their session is authenticated automatically at checkout. The login page is only needed for returning visitors whose session has expired.
Setting Up a Login Page
Option 1: Use the Built-In Template
ElasticFunnels includes a pre-built Members Login page template. When creating a new page, select the “Members Login” template from the template picker. It comes with:- Email input field
- Error/success message containers
- Submit button
- Styled card layout
- “Contact us” fallback link
Option 2: Build a Custom Login Form
Create a form that POSTs to/api/check-order with the customer’s email. The form needs three things:
action="/api/check-order"— The API endpointdata-redirect-url="/your-members-page"— Where to send the customer after successful login- Error/success message containers — Elements with
data-form-error-messageanddata-form-success-messageattributes
Minimal Example
Full Styled Example
How the Form Submission Works
ElasticFunnels automatically intercepts any form whoseaction starts with /api and submits it via JavaScript (AJAX). You do not need to write any JavaScript — the built-in form handler:
- Collects all form fields as JSON
- POSTs to the
actionURL (/api/check-order) - On success (HTTP 200):
- If
data-redirect-urlis set, redirects the customer to that URL - Otherwise, shows the
data-form-success-messageelement with the server response
- If
- On error (HTTP 400):
- Shows the
data-form-error-messageelement with the error text - The submit button is re-enabled so the customer can try again
- Shows the
Error Messages
The/api/check-order endpoint returns these errors:
| Error | Cause |
|---|---|
"Email is required" | The email field was empty |
"Please enter a valid email address." | The email format is invalid |
"We didn't find an order with that email address." | No purchase conversions exist for that email |
What Happens After Login
When login succeeds, the session is hydrated with data from the customer’s most recent order:session.email— Set to the submitted emailsession.customer— Populated with name, email, phone, billing/shipping addresses, and all order IDs
{{ customer.name }}, {{ customer.email }}, or the <order> tag / getOrders() function will now work correctly.
The customer is then redirected to the URL specified in data-redirect-url (typically your members dashboard page, e.g., /members).
Configuring the Members Dashboard Page
Your members dashboard page (the page customers land on after login) should be configured with Requires Login enabled in page settings:- Open the members dashboard page in the editor
- Go to Page Settings
- Enable Requires Login
- Set Redirect URL to
/members-login(your login page slug)