1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Properly handle credentials passed to /flows api

This commit is contained in:
Nick O'Leary 2021-03-06 20:09:03 +00:00
parent aa5e47b462
commit 101378c625
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -160,8 +160,15 @@ function setFlows(_config,_credentials,type,muteLog,forceStart,user) {
var credsDirty;
if (_credentials) {
credentials.clean(config);
// A full set of credentials have been provided. Use those instead
configSavePromise = credentials.load(_credentials);
let credentialSavePromises = [];
for (let id in _credentials) {
if (_credentials.hasOwnProperty(id)) {
credentialSavePromises.push(credentials.add(id,_credentials[id]));
}
}
configSavePromise = Promise.all(credentialSavePromises);
credsDirty = true;
} else {
// Allow the credential store to remove anything no longer needed