fix(preferences): Fix the issue when signature is too long and preferences are not saved. Note that MySQL profile table should be updated with a migration script

This commit is contained in:
smizrahi
2023-07-25 17:22:11 +02:00
parent ec27f7e714
commit 326bc68f4c
13 changed files with 95 additions and 9 deletions
+1
View File
@@ -22,6 +22,7 @@ endif
MainUI_RESOURCE_FILES += \
product.plist \
SOGoProfile.sql \
SOGoProfile-mysql.sql \
SOGoProfile-oracle.sql \
OCSFolderInfo.sql \
OCSFolderInfo-oracle.sql \
+11
View File
@@ -0,0 +1,11 @@
--
-- (C) 2004-2005 SKYRIX Software AG
-- (C) 2006-2007 Inverse inc.
-- (C) 2023 Alinto
--
CREATE TABLE @{tableName} (
c_uid VARCHAR(255) NOT NULL PRIMARY KEY,
c_defaults MEDIUMTEXT,
c_settings TEXT
);
@@ -248,6 +248,7 @@
"Digitally sign the message by default" = "Digitally sign the message by default";
"Always try to encrypt the message" = "Always try to encrypt the message";
"An error occurred while importing the certificate. Verify your password." = "An error occurred while importing the certificate. Verify your password.";
"Data too big. Please contact technical support." = "Data too big. Please contact technical support.";
/* Additional Parameters */
"Additional Parameters" = "Additional Parameters";
@@ -248,6 +248,7 @@
"Digitally sign the message by default" = "Toujours signer le message";
"Always try to encrypt the message" = "Toujours tenter de crypter le message";
"An error occurred while importing the certificate. Verify your password." = "Une erreur est survenue lors de l'importation du certificat. Veuillez vérifier votre mot de passe.";
"Data too big. Please contact technical support." = "Données trop longues. Contactez votre support technique.";
/* Additional Parameters */
"Additional Parameters" = "Paramètres supplémentaires";
+3
View File
@@ -1743,6 +1743,9 @@ static NSArray *reminderValues = nil;
else
results = (id <WOActionResults>) [self responseWithStatus: 503
andJSONRepresentation: [NSDictionary dictionaryWithObjectsAndKeys: @"Service temporarily unavailable", @"message", nil]];
} else {
results = (id <WOActionResults>) [self responseWithStatus: 500
andJSONRepresentation: [NSDictionary dictionaryWithObjectsAndKeys: @"Error during the validation", @"message", nil]];
}
}
File diff suppressed because one or more lines are too long
@@ -7,22 +7,21 @@
/**
* @ngInject
*/
AccountDialogController.$inject = ['$timeout', '$window', '$mdDialog', 'FileUploader', 'Dialog', 'sgSettings', 'defaults', 'account', 'accountId', 'mailCustomFromEnabled'];
function AccountDialogController($timeout, $window, $mdDialog, FileUploader, Dialog, Settings, defaults, account, accountId, mailCustomFromEnabled) {
AccountDialogController.$inject = ['$timeout', '$window', '$mdDialog', 'FileUploader', 'Dialog', 'sgSettings', 'defaults', 'account', 'accountId', 'mailCustomFromEnabled', 'maxSize'];
function AccountDialogController($timeout, $window, $mdDialog, FileUploader, Dialog, Settings, defaults, account, accountId, mailCustomFromEnabled, maxSize) {
var vm = this, usesSSO = $window.usesCASAuthentication || $window.usesSAML2Authentication;
this.defaultPort = 143;
this.defaults = defaults;
this.account = account;
this.maxSize = maxSize;
this.accountId = accountId;
this.hostnameRE = usesSSO && accountId > 0 ? /^(?!(127\.0\.0\.1|localhost(?:\.localdomain)?)$)/ : /./;
this.emailRE = String.emailRE;
this.addressesSearchText = '';
this.ckConfig = {
'autoGrow_minHeight': 70,
'toolbar': [['Bold', 'Italic', '-', 'Link',
'Font','FontSize','-','TextColor',
'BGColor', 'Source']],
removeButtons: 'Save,NewPage,Preview,Print,Templates,Cut,Copy,Paste,PasteText,PasteFromWord,Undo,Redo,Find,Replace,SelectAll,Scayt,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,CopyFormatting,RemoveFormat,NumberedList,BulletedList,Outdent,Indent,Blockquote,CreateDiv,JustifyLeft,JustifyCenter,JustifyRight,JustifyBlock,BidiLtr,BidiRtl,Language,Unlink,Anchor,Flash,Table,HorizontalRule,Smiley,SpecialChar,PageBreak,Iframe,Styles,Format,Maximize,ShowBlocks,About,Strike,Subscript,Superscript,Underline,Image,Emojipanel,Emoji,',
language: defaults.ckLocaleCode
};
@@ -155,7 +154,14 @@
};
this.save = function () {
$mdDialog.hide();
// Check if the size of the content os not too big. Otherwise it will fail while storing in database.
// This usually happens when using image signature
var data = JSON.stringify(this.account);
if (data.length > this.maxSize) {
Dialog.alert(l('Error'), l('Data too big. Please contact technical support.'));
} else {
$mdDialog.hide();
}
};
}
@@ -145,7 +145,8 @@
defaults: this.preferences.defaults,
account: account,
accountId: index,
mailCustomFromEnabled: $window.mailCustomFromEnabled
mailCustomFromEnabled: $window.mailCustomFromEnabled,
maxSize: this.preferences.defaults.CDefaultsSize
}
}).then(function() {
// Automatically expand the new mail account
@@ -173,7 +174,8 @@
defaults: this.preferences.defaults,
account: account,
accountId: index,
mailCustomFromEnabled: $window.mailCustomFromEnabled
mailCustomFromEnabled: $window.mailCustomFromEnabled,
maxSize: this.preferences.defaults.CDefaultsSize
}
}).then(function() {
vm.preferences.defaults.AuxiliaryMailAccounts[index] = account.$omit();