Obiettivo
Il flusso classico (flusso.html + /mockup) resta invariato.
Il FE ottimizzato usa azioni dedicate: QNLogin, QNLoginSocial,
QNVerifyOtp, QNRegister, QNUpdateProfile, QNAddPhone.
Rispondono con next_step (stessi numeri del flusso classico) oppure access_token.
- Social: se Piano chiede CONFIRM → mail passwordless Piano (codice/link) →
confirmed_token→ collegamento debug[]solo se debug abilitato per l’IP- Cookie
__utpimpostato dal backend quando viene emesso il token
Diagramma flusso login mockupfe
Pagine /mockupfe · API QN* · numeri = next_step
email / telefono / social"]) --> QNL["QNLogin"] Start --> SOC["QNLoginSocial
phase=start"] QNL -->|next_step 14
flow phone| OTP["otp.html
OTP SMS #14"] QNL -->|next_step 33
flow email_verify| OTPE["otp-email.html
OTP email #33"] SOC --> REDIR["Redirect Google/FB"] REDIR --> CB["social-callback.html
phase=code"] CB -->|OK → #50| S50{"ha otp_phone?"} CB -->|ADDITIONAL_INPUT| CONS["social-consents.html
phase=additional"] CB -->|CONFIRM| CONF["social-confirm.html
passwordless Piano + phase=confirm"] CONS --> S50 CONF --> S50 S50 -->|sì → #65/#90| OK(["success / newsletters
token + __utp"]) S50 -->|no → #61| PH2["phone.html
QNAddPhone #61"] OTP --> QNV1["QNVerifyOtp"] QNV1 -->|next_step 90| OK QNV1 -->|next_step 20
nuovo utente + phone_proof| REG["register.html
QNRegister phase=email_otp #22"] REG --> OTPE2["otp-email.html
OTP email #23"] OTPE2 --> QNV2["QNVerifyOtp #24
+ register_proof #24b"] QNV2 -->|next_step 25| PROF["profile.html #25
anagrafica + consensi"] PROF -->|register_proof| REG2["QNRegister #21
consensi+register+token"] REG2 -->|next_step 90| OK OTPE --> QNV3["QNVerifyOtp #34"] QNV3 -->|OTP ko| OTPE QNV3 -->|OTP ok → #30/#31/#50| QNV3b{"branch"} QNV3b -->|#50 sì → #65| OK QNV3b -->|next_step 37 + email_proof| PH["phone.html
QNAddPhone #37"] QNV3b -->|next_step 61 + uid| PH2 PH -->|phone_taken| ERR(["Errore
telefono già usato"]) PH -->|next_step 62| OTPP["otp-phone.html
OTP SMS #39"] OTPP --> QNV4["QNVerifyOtp"] QNV4 -->|next_step 41 + register_proof| PROF2["profile.html #41
consensi + anagrafica"] PROF2 -->|QNRegister #35| OK PH2 -->|next_step 62| OTPP2["otp-phone.html #62"] OTPP2 --> QNV5["QNVerifyOtp"] QNV5 -->|next_step 63| PROF3["profile.html #63 = #25
prefill anagrafica → QNUpdateProfile"] PROF3 --> OK classDef page fill:#e0f2f1,stroke:#00695c,color:#004d40; classDef api fill:#fff3e0,stroke:#e65100,color:#bf360c; classDef ok fill:#c8e6c9,stroke:#2e7d32,color:#1b5e20; classDef err fill:#ffcdd2,stroke:#c62828,color:#b71c1c; class Start,OTP,OTPE,REG,OTPE2,PH,PH2,OTPP,OTPP2,PROF,PROF2,PROF3,CB,CONS,CONF,REDIR page; class QNL,QNV1,QNV2,QNV3,QNV3b,QNV4,QNV5,REG2,SOC,S50 api; class OK ok; class ERR err;
Overview chiamate FE (sintesi)
1) QNLogin
POST ?action=QNLogin · { "identifier": "email|telefono" }
Orchestra fino a 14 (telefono, OTP SMS #13) o 33 (email, OTP #32).
| next_step | flow | Schermata |
|---|---|---|
| 14 | phone | otp.html |
| 33 | email_verify | otp-email.html |
2) QNVerifyOtp
POST ?action=QNVerifyOtp
Se OTP ok e non serve registrazione → search + token → next_step: 90 + access_token. Lato server, dopo il token viene eseguito User Collector ingest (non è una chiamata FE).
{
"otp_code": "1234",
"flow": "phone",
"phone": "3331234567",
"email": "user@mail.it",
"uid": "",
"stay_logged_in": true
}
| flow | Esito |
|---|---|
phone | #90 token oppure #20 register |
email_with_phone | #90 token |
email_verify | #34: OTP ko → #33; OTP ok → #30/#31/#50 → #37 / #61 / #65; account di un'altra app del gruppo → #60 password |
phone_register | #25 profilo (+ register_proof) → poi #21; email già di un account: di un'altra app del gruppo → #60 password; con telefono → token (done); senza telefono → #63 profilo, che salva il telefono con l'anagrafica |
email_register_phone | #41 profilo (+ register_proof) → poi #35 |
email_add_phone | #63 profilo → QNUpdateProfile |
3) QNRegister
POST ?action=QNRegister — fasi con proof firmati (no sessione).
Phone: #22→#25→#21 → #90. Email: #34→#37–39→#41→#35 (stessa chiamata: register con is_confirmed_email + consensi custom + update #40+#42) → #90.
{
"phase": "email_otp",
"email": "new@mail.it",
"phone": "3331234567",
"phone_proof": "...",
"flow": "phone_register"
}
{
"phase": "register",
"email": "new@mail.it",
"phone": "3331234567",
"register_proof": "...",
"consents": {
"terms_conditions": true,
"profiling_consent": false,
"marketing_consent": true
},
"first_name": "Luca",
"last_name": "Rossi",
"birth_date": "1990-01-15",
"city": "Milano",
"flow": "phone_register"
}
phase=email_otp→ 23 +pending_proofphase=register→register_proof+ profilo + consensi (#25/#41) → register (is_confirmed_email) + update consensi/profilo → 90
4) QNUpdateProfile
POST ?action=QNUpdateProfile — unisce update_profile + access_token.
{
"uid": "PNI...",
"first_name": "Luca",
"last_name": "Rossi",
"birth_date": "1990-01-15",
"city": "Milano",
"otp_phone": "3331234567",
"email": "user@mail.it",
"stay_logged_in": true
}
{
"success": true,
"data": {
"next_step": 90,
"done": true,
"uid": "PNI...",
"access_token": "...",
"screen": "success"
}
}
5) QNAddPhone
POST ?action=QNAddPhone — step 61–62 (dopo login password o registrazione email).
Prima di inviare l’OTP verifica che otp_phone non sia già usato. Se esiste → errore phone_taken.
{
"phone": "3331234567",
"uid": "PNI...",
"email": "user@mail.it",
"flow": "email_add_phone"
}
flow: email_add_phone— percorso password (#60→#61)flow: email_register_phone— percorso registrazione da email- Ok →
next_step: 62+ OTP SMS
6) QNLoginPassword
POST ?action=QNLoginPassword — step 60, per un account di un'altra app Piano del gruppo (Carlino, Nazione, Giorno) che entra per la prima volta in questa.
In Global Mode l'email trova l'account in tutte le app, ma Piano tiene un profilo per app e lo crea solo quando l'utente accede a quell'app. Senza profilo Piano non salva telefono e anagrafica (Invalid uid). Dopo il codice email QNVerifyOtp risponde next_step: 60, screen: password, password_proof e account_app (testata dell'account, o null); con la password dell'account Piano crea il profilo qui. Una volta sola: dalla volta dopo l'account è come gli altri.
{
"password_proof": "...",
"password": "..."
}
- Telefono già verificato (partito dal telefono) o già sull'account →
next_step: 63,screen: profile,profile_proof+ anagrafica →QNUpdateProfilePhone - Altrimenti (partito dall'email) →
next_step: 61,screen: phone,flow: email_add_phone,email_proof→QNAddPhone - Password sbagliata →
success: false,data.reason: "invalid_password"; vuota →"password_required" - Password dimenticata → POST ?action=QNResetPassword con lo stesso
password_proofe la password nuova (password, da 8 a 128 caratteri): Piano la imposta sull'identità e l'accesso prosegue come sopra. Vale una volta sola per account, perché l'accesso che segue crea il profilo in questa app (data.reason: "account_open"), solo nell'app che ha rilasciato il proof e per 10 minuti dal codice ("proof_expired").
Unicità telefono
- QNAddPhone — check prima dell’OTP
- QNVerifyOtp (
email_add_phone/email_register_phone) — ri-check dopo OTP - QNUpdateProfile e update_profile — check obbligatorio prima di salvare
otp_phone - Errore:
"Telefono già registrato su un altro account"·data.reason = phone_taken
Mappa mockupfe
| Pagina | API | Note |
|---|---|---|
index.html | QNLogin / QNLoginSocial | #14 / #33 · social → redirect |
social-callback.html | QNLoginSocial phase=code | OK / CONFIRM / ADDITIONAL_INPUT |
social-confirm.html | QNLoginSocial confirm_send + confirm | mail passwordless Piano → #50 |
social-consents.html | QNLoginSocial phase=additional | consensi → #50 |
otp.html | QNVerifyOtp | #90 o #20 |
otp-email.html | QNVerifyOtp | #24 → #25 profilo · oppure #34 → #37 telefono · account di un'altra app → #60 password |
register.html | QNRegister phase=email_otp | #22 OTP email (serve phone_proof) |
register-email.html | — | redirect a phone (consensi in #35) |
password.html | login | #60 → phone (legacy) |
phone.html | QNAddPhone | #37/#61 + pending_proof se email_register |
otp-phone.html | QNVerifyOtp | #39 → #41 · oppure #62 → #63 |
profile.html | QNRegister o QNUpdateProfile | con register_proof → #21/#35; altrimenti update |
newsletters.html | newsletter_* | dopo auth |
success.html | QNUserAccessList | valida __utp poi Piano publisher/user/access/list (uid) |
recommendations.html | recommendations | contenuti suggeriti Cxense (url + toptrend opz.) |