fix(preferences(js)): set account id before importing certificate

Fixes #5084
This commit is contained in:
Francis Lachapelle committed 2020-07-16 17:30:10 -04:00
1 parent b78e66a10b
commit 566fe55d71
3 files changed
+21 -6

No files matched your search

+14 -2
View File
@@ -1,6 +1,6 @@
/* UIxMailAccountActions.m - this file is part of SOGo
*
* Copyright (C) 2007-2017 Inverse inc.
* Copyright (C) 2007-2020 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -306,6 +306,7 @@
if (password && pkcs12)
{
NSData *certificate;
NSDictionary *description;
certificate = [pkcs12 convertPKCS12ToPEMUsingPassword: password];
@@ -314,7 +315,18 @@
[[self clientObject] setCertificate: certificate];
response = [self responseWith204];
description = [certificate certificateDescription];
if (description)
{
response = [self responseWithStatus: 200 andJSONRepresentation: description];
}
else
{
description = [NSDictionary
dictionaryWithObject: [self labelForKey: @"Error reading the certificate. Please install a new certificate."]
forKey: @"message"];
response = [self responseWithStatus: 500 andJSONRepresentation: description];
}
}
return response;