-
Notifications
You must be signed in to change notification settings - Fork 8
Localize Sesso rendering on /admin/users/details/<id>
#369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| // @ts-check | ||
| /** | ||
| * Issue #255 — configurable registration fields. 29-check E2E suite. | ||
| * Issue #255 — configurable registration fields. 30-check E2E suite. | ||
| * | ||
| * Coverage (all through the real browser): | ||
| * 1-4 defaults + SERVER-side enforcement of each built-in requirement | ||
|
|
@@ -18,7 +18,7 @@ | |
| * 23-24 sanitization: a tag-carrying label is neutralised on save; a | ||
| * script-carrying VALUE is escaped when rendered back (admin detail). | ||
| * 25 an inactive (attivo=0) field disappears from the public form. | ||
| * 26-29 profile/admin-detail regressions and destructive type-change guard. | ||
| * 26-30 profile/admin-detail regressions and destructive type-change guard. | ||
| */ | ||
|
|
||
| const { test, expect } = require('@playwright/test'); | ||
|
|
@@ -117,7 +117,7 @@ function userCount(email) { | |
| return Number(dbQuery(`SELECT COUNT(*) FROM utenti WHERE email='${email}'`)); | ||
| } | ||
|
|
||
| test.describe.serial('Issue #255 — configurable registration fields (29 checks)', () => { | ||
| test.describe.serial('Issue #255 — configurable registration fields (30 checks)', () => { | ||
| /** @type {import('@playwright/test').Page} */ | ||
| let admin; | ||
| /** @type {Map<string, string>} setting key -> original HEX(setting_value) */ | ||
|
|
@@ -511,4 +511,24 @@ test.describe.serial('Issue #255 — configurable registration fields (29 checks | |
| expect(dbQuery(`SELECT tipo FROM registrazione_campi WHERE id=${id}`)).toBe('text'); | ||
| await expect(admin.locator('body')).toContainText(/non puoi cambiare il tipo|cannot change the type|ne pouvez pas modifier le type|Typ eines Feldes/i); | ||
| }); | ||
|
|
||
| test('30. admin user details localize the stored sesso enum value', async ({ page }) => { | ||
| await setToggles(admin, false, false, false); | ||
| const email = `zz-255-sesso-${TOKEN}@example.test`; | ||
| await fillRegistration(page, { | ||
| fields: { nome: 'Sesso30', email, password: 'Password255!ok', password_confirm: 'Password255!ok' }, | ||
| }); | ||
| await submitNoValidate(page); | ||
| expect(userCount(email)).toBe(1); | ||
|
|
||
| dbQuery(`UPDATE utenti SET sesso='M' WHERE email='${email}'`); | ||
| const uid = dbQuery(`SELECT id FROM utenti WHERE email='${email}'`); | ||
|
|
||
| await admin.goto(`${BASE}/registrati`); | ||
| const expectedLabel = (await admin.locator('select[name="sesso"] option[value="M"]').innerText()).trim(); | ||
|
|
||
| await admin.goto(`${BASE}/admin/users/details/${uid}`); | ||
| const sessoValue = admin.locator('dt:has-text("Sesso") + dd'); | ||
| await expect(sessoValue).toHaveText(expectedLabel); | ||
| }); | ||
|
Comment on lines
+515
to
+533
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Completare il flusso E2E richiesto. Avviare 📍 Affects 1 file
🤖 Prompt for AI AgentsSource: Path instructions |
||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Sostituire
HtmlHelper::e()nel percorso di rendering.La nuova visualizzazione usa
$display($sessoLabel). La closure$display()chiamaHtmlHelper::e()alla linea 49. La regola delle view vietaHtmlHelper::e()e richiedehtmlspecialchars(..., ENT_QUOTES, 'UTF-8').Aggiornare la closure
$display()per usarehtmlspecialchars($value, ENT_QUOTES, 'UTF-8'). Questo mantiene sicuro anche il fallback per valori legacy inattesi.As per path instructions, "Mai usare
HtmlHelper::e()nelle view — usarehtmlspecialchars(..., ENT_QUOTES, 'UTF-8')".🤖 Prompt for AI Agents
Source: Path instructions