Email / SMS code login
Let users log in with a cloud-sent email or phone code — no passwords to remember.
The problem today
Your project has no cloud account system; anyone can open it and data is not per-user.
What you get
- Full sign-up / login / logout flow
- Code sending & verification
- Users only see their own data after login
Copy the whole block below and paste it into Codex. Replace placeholders like API keys with real values from the IFQ Cloud console.
You are a senior full-stack engineer. In my currently open local project, add "email or SMS verification-code login" with cloud-sent and cloud-verified codes so users must log in before using core features.
[Features to build]
- Provide sign-up, login, and logout entries; UI in the app language and consistent with the existing style.
- Login flow: user enters email or phone, cloud sends a code, correct code logs them in.
- Persist login state after success; stays logged in across refresh/restart until logout.
- Protect core pages: redirect to login when not authenticated.
[Connect to IFQ Cloud]
- API base https://api.cloud.ifq.ai, official SDK `jieshi-cloud` (if unavailable, use plain HTTPS equivalently and note the endpoint in a comment).
- Secrets via environment variables, never hard-coded: JIESHI_CLOUD_API_KEY, JIESHI_CLOUD_PROJECT_ID; generate `.env.example` with both, noting "get real values from the IFQ Cloud console and replace".
- All placeholders; without real values, run on placeholders and print a hint on where to replace them.
[Engineering requirements]
- Read the existing structure and stack first; follow current conventions, add only necessary files, leave unrelated code untouched.
- Network calls: timeout + graceful fallback; friendly errors, never crash.
- Demo / mock mode: the main flow runs on sample data without keys.
- Include a minimal runnable self-test with run instructions.
- On completion list: files changed / how to start / how to roll back.
Ask before any decision point.
*— [ifq.ai](https://work.ifq.ai/) · AI-augmented. Full-stack crafted*