From aa877dea0a298652d91811d1049cb64a358cc2e5 Mon Sep 17 00:00:00 2001 From: Surya Paolo Date: Wed, 19 Nov 2025 11:39:42 +0100 Subject: [PATCH] - asggiunto bottone "installa app" sulla email di conferma registrazione e anche la Guida "/guida". - migliorato InvitaAmico --- .env.development | 2 +- .env.prod.riso | 2 +- .env.test.risosrv | 2 +- emails/registration/it/html.pug | 74 +++++++++++++++++++++++++++++---- src/middleware/authenticate.js | 11 ++--- src/server/serverUtils.js | 2 + src/server/startServer.js | 2 +- src/version.txt | 2 +- 8 files changed, 79 insertions(+), 18 deletions(-) diff --git a/.env.development b/.env.development index 7bca35d..f76bbfa 100644 --- a/.env.development +++ b/.env.development @@ -29,7 +29,7 @@ GCM_API_KEY="" PROD=0 PROJECT_DESCR_MAIN='__PROJECTS' SECRK=Askb38v23jjDFaoskBOWj92axXCQ -TOKEN_LIFE=10m +TOKEN_LIFE=2m REFRESH_TOKEN_LIFE=14d FTPSERVER_HOST=139.162.166.31 FTPSERVER_PORT=21 diff --git a/.env.prod.riso b/.env.prod.riso index 23d2d70..d3ad1fc 100644 --- a/.env.prod.riso +++ b/.env.prod.riso @@ -31,7 +31,7 @@ TOKEN_LIFE=2h REFRESH_TOKEN_LIFE=14d AUTH_NEW_SITES=B234HDSAOJ734ndcsdKWNV DOMAINS=[{"hostname":"riso.app","port":"3006"},{"hostname":"freeplanet.app","port":"3000"},{"hostname":"nuovomondo.app","port":"3032"}] -DOMAINS_ALLOWED=["comunitanuovomondo.app","nuovomondo.app","kolibrilab.it","artenergetica.org","freeplanet.app","www.freeplanet.app","freeplanet.app:3000","freeplanet.app:3001","www.freeplanet.app:3000","www.freeplanet.app:3001"] +DOMAINS_ALLOWED=["riso.app","comunitanuovomondo.app","nuovomondo.app","kolibrilab.it","artenergetica.org","freeplanet.app","www.freeplanet.app","freeplanet.app:3000","freeplanet.app:3001","www.freeplanet.app:3000","www.freeplanet.app:3001"] #DOMAINS=[{"hostname":"abitaregliiblei.it","port":"3021"},{"hostname":"riso.app","port":"3005"}] SCRIPTS_DIR=admin_scripts CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}] diff --git a/.env.test.risosrv b/.env.test.risosrv index 749a47b..bf5eeb7 100644 --- a/.env.test.risosrv +++ b/.env.test.risosrv @@ -32,7 +32,7 @@ TOKEN_LIFE=2h REFRESH_TOKEN_LIFE=14d AUTH_NEW_SITES=B234HDSAOJ734ndcsdKWNV DOMAINS=[{"hostname":"riso.app","port":"3005"},{"hostname":"nuovomondo.app","port":"3033"}] -DOMAINS_ALLOWED=["comunitanuovomondo.app","kolibrilab.it","artenergetica.org","freeplanet.app","www.freeplanet.app","freeplanet.app:3000","freeplanet.app:3001","www.freeplanet.app:3000","www.freeplanet.app:3001"] +DOMAINS_ALLOWED=["riso.app","comunitanuovomondo.app","kolibrilab.it","artenergetica.org","freeplanet.app","www.freeplanet.app","freeplanet.app:3000","freeplanet.app:3001","www.freeplanet.app:3000","www.freeplanet.app:3001"] SCRIPTS_DIR=admin_scripts CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}] MIAB_HOST=box.lamiaposta.org diff --git a/emails/registration/it/html.pug b/emails/registration/it/html.pug index 78fad33..ceda445 100755 --- a/emails/registration/it/html.pug +++ b/emails/registration/it/html.pug @@ -138,10 +138,19 @@ html(lang="it") margin-bottom: 16px; } + .cta-buttons-wrapper { + display: flex; + gap: 12px; + justify-content: center; + align-items: stretch; + flex-wrap: wrap; + margin-top: 16px; + } + .cta-button { display: inline-block; - padding: 16px 48px; - font-size: 18px; + padding: 16px 32px; + font-size: 16px; font-weight: 600; color: white; background: linear-gradient(135deg, #027be3 0%, #0056b3 100%); @@ -149,6 +158,9 @@ html(lang="it") text-decoration: none; box-shadow: 0 4px 12px rgba(2, 123, 227, 0.3); transition: transform 0.2s, box-shadow 0.2s; + flex: 1; + min-width: 180px; + max-width: 220px; } .cta-button:hover { @@ -156,6 +168,30 @@ html(lang="it") box-shadow: 0 6px 16px rgba(2, 123, 227, 0.4); } + .cta-button-secondary { + background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%); + box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3); + } + + .cta-button-secondary:hover { + box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4); + } + + .cta-button-tertiary { + background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%); + box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3); + } + + .cta-button-tertiary:hover { + box-shadow: 0 6px 16px rgba(255, 152, 0, 0.4); + } + + .button-icon { + font-size: 18px; + margin-right: 6px; + vertical-align: middle; + } + .alternative-link { margin-top: 16px; font-size: 13px; @@ -236,11 +272,16 @@ html(lang="it") font-size: 14px; } + .cta-buttons-wrapper { + flex-direction: column; + gap: 12px; + } + .cta-button { - padding: 14px 32px; - font-size: 16px; + padding: 14px 24px; + font-size: 15px; width: 100%; - max-width: 300px; + max-width: 100%; } } @@ -260,7 +301,9 @@ html(lang="it") .cta-title 🔐 1. Verifica il tuo account if strlinkreg - a.cta-button(href=strlinkreg target="_blank") Verifica Registrazione + a.cta-button(href=strlinkreg target="_blank") + span.button-icon ✓ + | Verifica Registrazione .alternative-link | Oppure copia e incolla questo link nel tuo browser: @@ -274,10 +317,25 @@ html(lang="it") strong  completare il tuo profilo. .cta-section - .cta-title 🔐 2. Per accedere alla piattaforma #{nomeapp} + - var numstep = 1; + if !verified_email + - var numstep = 2; + + .cta-title 🚀 #{numstep}. Accedi e installa #{nomeapp} if strlinksito - a.cta-button(href=strlinksito target="_blank") Accedi a #{nomeapp} + .cta-buttons-wrapper + a.cta-button(href=strlinksito target="_blank") + span.button-icon 🌐 + | Accedi a #{nomeapp} da web + + a.cta-button.cta-button-secondary(href=strlinksito+'/installaapp' target="_blank") + span.button-icon 📱 + | Installa l'App + + a.cta-button.cta-button-tertiary(href=strlinksito+'/guida' target="_blank") + span.button-icon 📖 + | Vai alla Guida .credentials-box .credentials-title 📋 I tuoi dati di accesso diff --git a/src/middleware/authenticate.js b/src/middleware/authenticate.js index 26ba906..672330a 100755 --- a/src/middleware/authenticate.js +++ b/src/middleware/authenticate.js @@ -98,11 +98,12 @@ function logResponse(req, res, data) { const emoji = statusCode >= 200 && statusCode < 300 ? '✅' : statusCode >= 400 && statusCode < 500 ? '⚠️' : '❌'; - console.log( - `${emoji} [${method}] ${url} | Status: ${statusCode} | User: ${userId} | Data: ${ - data ? JSON.stringify(data).substring(0, 100) : 'empty' - }` - ); + if (statusCode !== 200) { + console.log( + `${emoji} [${method}] ${url} | Status: ${statusCode} | User: ${userId} | Data: ${data ? JSON.stringify(data).substring(0, 100) : 'empty' + }` + ); + } } const authenticate = (req, res, next) => authenticateMiddleware(req, res, next); diff --git a/src/server/serverUtils.js b/src/server/serverUtils.js index 77aa877..61bc365 100644 --- a/src/server/serverUtils.js +++ b/src/server/serverUtils.js @@ -62,6 +62,8 @@ function createCorsOptions(domains, domainsAllowed, isProduction, noCors = false const allowedOrigins = buildAllowedOrigins(domains, domainsAllowed, isProduction); + console.log('allowedOrigins:', allowedOrigins.map((origin) => `'${origin}'`).join(', ')); + let originValidator = (origin, callback) => { if (!origin) { // console.log('✅ Origin undefined or empty — allowing'); diff --git a/src/server/startServer.js b/src/server/startServer.js index ba488f1..3272a5e 100644 --- a/src/server/startServer.js +++ b/src/server/startServer.js @@ -16,7 +16,7 @@ async function myLoad() { } async function startServer(app, port) { - const isProduction = process.env.NODE_ENV === 'production'; + const isProduction = ['production', 'test'].includes(process.env.NODE_ENV); const { domains, domainsAllowed } = parseDomains(); const corsOptions = createCorsOptions(domains, domainsAllowed, isProduction); diff --git a/src/version.txt b/src/version.txt index 2833ec4..3c9b023 100644 --- a/src/version.txt +++ b/src/version.txt @@ -1 +1 @@ -1.2.78 \ No newline at end of file +1.2.79 \ No newline at end of file