Viewing: README.md
# yucai Website
Static site + light-weight PHP helpers that power the FACES / Yucai website.
## Parent Portal (Tuition Access)
Parents can log in at `/parents/` to view tuition balances, payment status, and notes.
- Credentials are stored in `parents/data/parents.json` (auto-created).
- Authentication uses secure password hashes (`password_hash` / `password_verify`).
- Tuition data is scoped per family; only logged-in parents can see their information.
- Parents can self-service password resets via `/parents/forgot-password.php` (links appear on the login page).
### Admin Membership Console
- Copy `parents/admin/config.sample.php` to `parents/admin/config.php`, set the admin username (defaults to `admin`), and replace the password hash with one generated for your chosen admin password:
```bash
php -r "echo password_hash('your-new-admin-password', PASSWORD_DEFAULT), PHP_EOL;"
```
- Visit `/parents/admin/` and sign in with that password to open a form for adding or updating families (email, guardian name, students, tuition line items, due dates, notes, optional password reset).
- Existing families appear in a quick list for one-click loading.
- Admin sessions can be ended via `/parents/admin/logout.php`.
### Managing Parent Accounts
Use the helper script to create or update parent profiles:
```bash
php parents/scripts/manage_parent.php --email=family@example.com \
--name="Lee Family" \
--password="StrongPass9" \
--students="Alice,Bob" \
--tuition="Afterschool Fall 2024|1450|due|2024-09-10|Includes supplies" \
--tuition="Writing Workshop|250|paid|2024-08-01|Paid via check or cash."
```
Key notes:
- Run the script again with the same `--email` to update tuition items or reset a password.
- Tuition format: `label|amount|status|due_date|notes`. Only `label` and `amount` are required.
- Passwords must be at least 8 characters with upper, lower, and numeric characters.
- The JSON file is locked during writes to avoid conflicts when multiple admins update it.
### Portal Pages
- `parents/login.php` β parent login form.
- `parents/forgot-password.php` β request a password reset link.
- `parents/reset-password.php` β enter a new password using the emailed token.
- `parents/admin/index.php` β password-protected admin panel for managing memberships.
- `parents/admin/login.php` / `parents/admin/logout.php` β admin session endpoints.
- `parents/admin/tuition-board.php` β admin view focused on entering/editing tuition line items with totals per family.
- `parents/tuition.php` β protected tuition summary page (requires login).
- `parents/logout.php` β clears the session and redirects to the login page.
Navigation links to the portal are present on `index.html` and `index_en.html`.
### Google Sign-In (optional)
- Set your Google OAuth client ID in `parents/bootstrap.php` (`PARENTS_GOOGLE_CLIENT_ID`). Use a Web client ID from the Google Cloud Console.
- The login page will show a βContinue with Googleβ button. On success, the backend verifies the ID token via Google, matches the verified email to an existing parent record, and logs the user in.
- Only emails that already exist in `parents/data/parents.json` are allowed; others get a friendly error. Replace the placeholder client ID to enable the button.
Close