Relax signature preference validation for FirmaEC
This commit is contained in:
+5
-1
@@ -2,10 +2,14 @@
|
||||
|
||||
## Versión actual
|
||||
|
||||
- Versión base: `1.2.17`
|
||||
- Versión base: `1.2.18`
|
||||
|
||||
## 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
|
||||
|
||||
- Web y backend agregan el estilo de firma `FirmaEC`, con vista previa configurable y sello visible con QR de validación.
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
## Versión actual
|
||||
|
||||
- Base actual: `1.2.17`
|
||||
- Base actual: `1.2.18`
|
||||
- Fuente de verdad: [VERSION](/home/mgonzalez/desarrollo/react/linkedsign/VERSION)
|
||||
- Historial de cambios: [CHANGELOG.md](/home/mgonzalez/desarrollo/react/linkedsign/CHANGELOG.md)
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
## Versión actual
|
||||
|
||||
- Base actual: `1.2.17`
|
||||
- Base actual: `1.2.18`
|
||||
- Fuente de verdad: [VERSION](/home/mgonzalez/desarrollo/react/linkedsign/VERSION)
|
||||
- Historial de cambios: [CHANGELOG.md](/home/mgonzalez/desarrollo/react/linkedsign/CHANGELOG.md)
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
## Versión actual
|
||||
|
||||
- Base actual: `1.2.17`
|
||||
- Base actual: `1.2.18`
|
||||
- Fuente de verdad: [VERSION](/home/mgonzalez/desarrollo/react/linkedsign/VERSION)
|
||||
- Historial de cambios: [CHANGELOG.md](/home/mgonzalez/desarrollo/react/linkedsign/CHANGELOG.md)
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ android {
|
||||
applicationId "net.linkedcorp.linkedsign"
|
||||
minSdk 26
|
||||
targetSdk 35
|
||||
versionCode 10217
|
||||
versionName "1.2.17"
|
||||
versionCode 10218
|
||||
versionName "1.2.18"
|
||||
|
||||
buildConfigField "String", "API_BASE_URL", "\"${apiBaseUrl}\""
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "linkedsign-backend",
|
||||
"version": "1.2.17",
|
||||
"version": "1.2.18",
|
||||
"private": true,
|
||||
"description": "Initial backend for LinkedSign",
|
||||
"main": "src/server.js",
|
||||
|
||||
@@ -4,41 +4,32 @@ const ALLOWED_SIGNATURE_STYLES = ['classic', 'qr', 'professional', 'firmaec'];
|
||||
const ALLOWED_QR_POSITIONS = ['left', 'right'];
|
||||
const ALLOWED_QR_BACKGROUNDS = ['transparent', 'soft'];
|
||||
const ALLOWED_QR_BORDERS = ['none', 'line'];
|
||||
const LEGACY_SIGNATURE_STYLE_MAP = {
|
||||
image: 'qr',
|
||||
};
|
||||
|
||||
const getSignaturePreferences = async (userId) => {
|
||||
return usersRepository.getSignaturePreferences(userId);
|
||||
};
|
||||
|
||||
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.');
|
||||
error.statusCode = 400;
|
||||
throw error;
|
||||
}
|
||||
|
||||
if (!ALLOWED_QR_POSITIONS.includes(qrPosition)) {
|
||||
const error = new Error('Invalid QR position.');
|
||||
error.statusCode = 400;
|
||||
throw error;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
// Preferences should be resilient to stale clients or partially populated forms.
|
||||
const resolvedQrPosition = ALLOWED_QR_POSITIONS.includes(qrPosition) ? qrPosition : 'left';
|
||||
const resolvedQrBackground = ALLOWED_QR_BACKGROUNDS.includes(qrBackground) ? qrBackground : 'transparent';
|
||||
const resolvedQrBorder = ALLOWED_QR_BORDERS.includes(qrBorder) ? qrBorder : 'none';
|
||||
|
||||
return usersRepository.setSignaturePreferences(userId, {
|
||||
signatureStyle,
|
||||
qrPosition,
|
||||
qrBackground,
|
||||
qrBorder,
|
||||
signatureStyle: normalizedSignatureStyle,
|
||||
qrPosition: resolvedQrPosition,
|
||||
qrBackground: resolvedQrBackground,
|
||||
qrBorder: resolvedQrBorder,
|
||||
signatureImageBase64: signatureImageBase64 || null,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"private": true,
|
||||
"version": "1.2.17",
|
||||
"version": "1.2.18",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
Reference in New Issue
Block a user