PLT-3629 fix uploading certificates if the files in the config do not exists (#3634)

Этот коммит содержится в:
enahum
2016-07-20 17:01:10 -04:00
коммит произвёл Corey Hulen
родитель b0090214ef
Коммит 86d496c9b7
5 изменённых файлов: 71 добавлений и 1 удалений

Просмотреть файл

@@ -1667,4 +1667,17 @@ export default class Client {
send({filename}).
end(this.handleResponse.bind(this, 'removeCertificateFile', success, error));
}
samlCertificateStatus(success, error) {
request.get(`${this.getAdminRoute()}/saml_cert_status`).
set(this.defaultHeaders).
type('application/json').
accept('application/json').
end((err, res) => {
if (err) {
return error(err);
}
return success(res.body);
});
}
}

Просмотреть файл

@@ -70,6 +70,26 @@ export default class SamlSettings extends AdminSettings {
};
}
componentWillMount() {
Client.samlCertificateStatus(
(data) => {
const files = {};
if (!data.IdpCertificateFile) {
files.idpCertificateFile = '';
}
if (!data.PublicCertificateFile) {
files.publicCertificateFile = '';
}
if (!data.PrivateKeyFile) {
files.privateKeyFile = '';
}
this.setState(files);
}
);
}
uploadCertificate(id, file, callback) {
Client.uploadCertificateFile(
file,