Relax signature preference validation for FirmaEC

This commit is contained in:
2026-05-21 22:28:44 -05:00
parent 8bc244855c
commit 8308e3537e
9 changed files with 26 additions and 31 deletions
+5 -1
View File
@@ -2,10 +2,14 @@
## Versión actual ## Versión actual
- Versión base: `1.2.17` - Versión base: `1.2.18`
## Historial ## Historial
### 1.2.18 - 2026-05-21
- Backend vuelve tolerante el guardado de preferencias de firma para aceptar clientes parciales o legados y evitar errores al guardar `FirmaEC`.
### 1.2.17 - 2026-05-21 ### 1.2.17 - 2026-05-21
- Web y backend agregan el estilo de firma `FirmaEC`, con vista previa configurable y sello visible con QR de validación. - Web y backend agregan el estilo de firma `FirmaEC`, con vista previa configurable y sello visible con QR de validación.
+1 -1
View File
@@ -2,7 +2,7 @@
## Versión actual ## Versión actual
- Base actual: `1.2.17` - Base actual: `1.2.18`
- Fuente de verdad: [VERSION](/home/mgonzalez/desarrollo/react/linkedsign/VERSION) - Fuente de verdad: [VERSION](/home/mgonzalez/desarrollo/react/linkedsign/VERSION)
- Historial de cambios: [CHANGELOG.md](/home/mgonzalez/desarrollo/react/linkedsign/CHANGELOG.md) - Historial de cambios: [CHANGELOG.md](/home/mgonzalez/desarrollo/react/linkedsign/CHANGELOG.md)
+1 -1
View File
@@ -2,7 +2,7 @@
## Versión actual ## Versión actual
- Base actual: `1.2.17` - Base actual: `1.2.18`
- Fuente de verdad: [VERSION](/home/mgonzalez/desarrollo/react/linkedsign/VERSION) - Fuente de verdad: [VERSION](/home/mgonzalez/desarrollo/react/linkedsign/VERSION)
- Historial de cambios: [CHANGELOG.md](/home/mgonzalez/desarrollo/react/linkedsign/CHANGELOG.md) - Historial de cambios: [CHANGELOG.md](/home/mgonzalez/desarrollo/react/linkedsign/CHANGELOG.md)
+1 -1
View File
@@ -2,7 +2,7 @@
## Versión actual ## Versión actual
- Base actual: `1.2.17` - Base actual: `1.2.18`
- Fuente de verdad: [VERSION](/home/mgonzalez/desarrollo/react/linkedsign/VERSION) - Fuente de verdad: [VERSION](/home/mgonzalez/desarrollo/react/linkedsign/VERSION)
- Historial de cambios: [CHANGELOG.md](/home/mgonzalez/desarrollo/react/linkedsign/CHANGELOG.md) - Historial de cambios: [CHANGELOG.md](/home/mgonzalez/desarrollo/react/linkedsign/CHANGELOG.md)
+1 -1
View File
@@ -1 +1 @@
1.2.17 1.2.18
+2 -2
View File
@@ -18,8 +18,8 @@ android {
applicationId "net.linkedcorp.linkedsign" applicationId "net.linkedcorp.linkedsign"
minSdk 26 minSdk 26
targetSdk 35 targetSdk 35
versionCode 10217 versionCode 10218
versionName "1.2.17" versionName "1.2.18"
buildConfigField "String", "API_BASE_URL", "\"${apiBaseUrl}\"" buildConfigField "String", "API_BASE_URL", "\"${apiBaseUrl}\""
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "linkedsign-backend", "name": "linkedsign-backend",
"version": "1.2.17", "version": "1.2.18",
"private": true, "private": true,
"description": "Initial backend for LinkedSign", "description": "Initial backend for LinkedSign",
"main": "src/server.js", "main": "src/server.js",
+13 -22
View File
@@ -4,41 +4,32 @@ const ALLOWED_SIGNATURE_STYLES = ['classic', 'qr', 'professional', 'firmaec'];
const ALLOWED_QR_POSITIONS = ['left', 'right']; const ALLOWED_QR_POSITIONS = ['left', 'right'];
const ALLOWED_QR_BACKGROUNDS = ['transparent', 'soft']; const ALLOWED_QR_BACKGROUNDS = ['transparent', 'soft'];
const ALLOWED_QR_BORDERS = ['none', 'line']; const ALLOWED_QR_BORDERS = ['none', 'line'];
const LEGACY_SIGNATURE_STYLE_MAP = {
image: 'qr',
};
const getSignaturePreferences = async (userId) => { const getSignaturePreferences = async (userId) => {
return usersRepository.getSignaturePreferences(userId); return usersRepository.getSignaturePreferences(userId);
}; };
const updateSignaturePreferences = async (userId, { signatureStyle, qrPosition, qrBackground, qrBorder, signatureImageBase64 }) => { const updateSignaturePreferences = async (userId, { signatureStyle, qrPosition, qrBackground, qrBorder, signatureImageBase64 }) => {
if (!ALLOWED_SIGNATURE_STYLES.includes(signatureStyle)) { const normalizedSignatureStyle = LEGACY_SIGNATURE_STYLE_MAP[String(signatureStyle || '').toLowerCase()] || signatureStyle;
if (!ALLOWED_SIGNATURE_STYLES.includes(normalizedSignatureStyle)) {
const error = new Error('Invalid signature style.'); const error = new Error('Invalid signature style.');
error.statusCode = 400; error.statusCode = 400;
throw error; throw error;
} }
if (!ALLOWED_QR_POSITIONS.includes(qrPosition)) { // Preferences should be resilient to stale clients or partially populated forms.
const error = new Error('Invalid QR position.'); const resolvedQrPosition = ALLOWED_QR_POSITIONS.includes(qrPosition) ? qrPosition : 'left';
error.statusCode = 400; const resolvedQrBackground = ALLOWED_QR_BACKGROUNDS.includes(qrBackground) ? qrBackground : 'transparent';
throw error; const resolvedQrBorder = ALLOWED_QR_BORDERS.includes(qrBorder) ? qrBorder : 'none';
}
if (!ALLOWED_QR_BACKGROUNDS.includes(qrBackground)) {
const error = new Error('Invalid QR background.');
error.statusCode = 400;
throw error;
}
if (!ALLOWED_QR_BORDERS.includes(qrBorder)) {
const error = new Error('Invalid QR border.');
error.statusCode = 400;
throw error;
}
return usersRepository.setSignaturePreferences(userId, { return usersRepository.setSignaturePreferences(userId, {
signatureStyle, signatureStyle: normalizedSignatureStyle,
qrPosition, qrPosition: resolvedQrPosition,
qrBackground, qrBackground: resolvedQrBackground,
qrBorder, qrBorder: resolvedQrBorder,
signatureImageBase64: signatureImageBase64 || null, signatureImageBase64: signatureImageBase64 || null,
}); });
}; };
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "frontend", "name": "frontend",
"private": true, "private": true,
"version": "1.2.17", "version": "1.2.18",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",