feat: password recovery by e-mail, team alerts, and a price for files opened by hand
Pilot customers had no way to reset a forgotten password, and the 7 October meeting asked for two things that only needed the client's inputs to go live. Password recovery: "Esqueci minha senha" in Minha conta sends a link that works once, for an hour (/conta/redefinir#token, in the fragment so it never reaches a server or a Referer). Only the token's hash is stored, the e-mail's text is erased once sent, the answer never says whether an account exists, and a reset signs out every other session. Limited per address and source. Team alerts: Kanban users who tick "Receber alertas por e-mail" in Usuários get one when an order is paid, a cart waits for review, or a payment needs attention. Messages are queued in the transaction that caused them and sent by the worker with retries (app/mail.py). Integrações shows an E-mail row with "Enviar teste". E-mail is off in production (MAIL_ADAPTER=off; recovery keeps offering WhatsApp) until the client's SMTP account exists; then it is only settings (docs/PORTAINER.md). The local stack keeps messages in the database and log. Files opened by hand: a finished sheet in CDR, AI, PSD or TIFF (or with a length the customer typed) pays the full price plus MANUAL_FILE_EXTRA_CENTS per metre, to steer customers to PNG as the meeting asked. It is 0 until Marcus gives the amount. The Site shows it before checkout, the server charges it, Tiny gets it in the unit price, and the Kanban says it. Tested: new tests/mail_test (reset flow, SMTP delivery against a local SMTP server, retry, who gets alerts), pricing unit tests, and the browser test now checks the Site total equals the server's, run with the charge at 0 and at R$ 5,00. The full CI suite passes in a CI-style stack. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -161,6 +161,12 @@ the ready-sheet option before uploading. PDF and manual-format ready sheets keep
|
||||
their existing workflow. These models retain their separate approved price tiers;
|
||||
image dimensions alone must never classify a normal artwork as a finished sheet.
|
||||
|
||||
A finished sheet someone must open by hand (CDR, AI, PSD, TIFF, or a length the
|
||||
customer typed) pays the top of the ladder plus `MANUAL_FILE_EXTRA_CENTS` per
|
||||
metre (2026-10-13, asked at the 7 October meeting to steer customers to PNG).
|
||||
It defaults to 0; the amount is the client's to set. The Site reads it from
|
||||
`/api/session` and shows it before checkout; `app/core/pricing.py` charges it.
|
||||
|
||||
## Freight
|
||||
|
||||
The original visual freight flow in `web/index.html` was a stub with only pickup
|
||||
@@ -202,6 +208,17 @@ Tiny/Olist is already available. The implementation must create/update orders
|
||||
idempotently and use the order number for traceability. Confirm the actual API
|
||||
endpoints, marker/tag behaviour, and rate limits before production use.
|
||||
|
||||
### E-mail
|
||||
|
||||
`app/mail.py` (2026-10-13): customers' password recovery (a one-time link,
|
||||
valid one hour, sent to `/conta/redefinir#token`; only the token's hash is
|
||||
stored and the message text is erased once sent) and alerts to the Kanban
|
||||
users who switch them on (order paid, quote waiting for review, payment
|
||||
needing attention). Messages are queued in the transaction that caused them and
|
||||
sent by the worker with retries. `MAIL_ADAPTER` is `off` in production until
|
||||
the client's SMTP account exists (recovery then offers WhatsApp), `log` on the
|
||||
local stack, `smtp` with `SMTP_*` and `MAIL_FROM`.
|
||||
|
||||
### WhatsApp
|
||||
|
||||
WhatsApp is already available, but the technical provider still needs to be
|
||||
@@ -370,8 +387,9 @@ referenced them; recover from Git history if ever needed.
|
||||
authentication, purchase history, or real cart persistence. Local order
|
||||
persistence, reviewed quotes, mock freight and fake payment now work through
|
||||
`web/checkout.js`. The local customer portal now provides accounts and
|
||||
order history; cart recovery is browser-local. Production account verification,
|
||||
recovery, and cross-device cart editing are still absent.
|
||||
order history; cart recovery is browser-local. Password recovery by e-mail
|
||||
exists (see E-mail) but waits for the client's SMTP account; account e-mail
|
||||
verification and cross-device cart editing are still absent.
|
||||
- Without the local bridge, the original freight fallback remains a stub.
|
||||
Real freight quotation remains unimplemented in all runtimes.
|
||||
- The existing the removed prototypes duplicated WhatsApp senders and send
|
||||
|
||||
@@ -190,6 +190,21 @@ It refuses if any payment was made with real money. Order numbers restart at
|
||||
run in the `db` container's console. Add `--contas` to remove the test
|
||||
customer accounts too.
|
||||
|
||||
## 7. E-mail and prices set in the stack
|
||||
|
||||
E-mail stays off (`MAIL_ADAPTER=off`) until the client's SMTP account exists.
|
||||
Then set, in the stack's environment, `MAIL_ADAPTER=smtp`, `MAIL_FROM` (for
|
||||
example `DTF Dropstar <nao-responda@SITE_DOMAIN>`), `SMTP_HOST`, `SMTP_PORT`,
|
||||
`SMTP_SECURITY` (`starttls` on 587, `ssl` on 465), `SMTP_USER` and
|
||||
`SMTP_PASSWORD`, and redeploy; the API and worker refuse to start if a required
|
||||
one is missing. Check it with **Integrações → E-mail → Enviar teste** on the
|
||||
Kanban, then switch on "Receber alertas por e-mail" for whoever wants alerts in
|
||||
Usuários. Use a sending domain with SPF and DKIM, or the messages land in spam.
|
||||
|
||||
`MANUAL_FILE_EXTRA_CENTS` is the per-metre charge on finished sheets someone
|
||||
opens by hand (CDR, AI, PSD, TIFF); 500 is R$ 5,00 a metro. Change it only on
|
||||
the client's instruction; the Site shows the new price after the redeploy.
|
||||
|
||||
## Current blocker
|
||||
|
||||
This is the final deployment shape, but it is not authorized for production
|
||||
|
||||
Reference in New Issue
Block a user