Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ <h4 style="margin-top: 0px;">Add Parameters:</h4>
<input id="description" type="text" class="form-control" name="description" ng-model="params.paramDesc" disabled="disabled">
</td>
<td>
<input type="text" class="form-control" name="value" ng-if="params.paramType === '' || params.paramType === 'Default'" ng-model="params.paramVal">
<input type="password" class="form-control" name="value" ng-if="params.paramType === 'Password'" ng-model="params.paramVal">
<input type="text" class="form-control" name="value" ng-if="params.paramType === 'Restricted'" ng-model="params.paramVal">
<input type="text" class="form-control" name="value" ng-if="params.paramType === '' || params.paramType === 'Default'" ng-model="params.paramVal" required>
<input type="password" class="form-control" name="value" ng-if="params.paramType === 'Password'" ng-model="params.paramVal" required>
<input type="text" class="form-control" name="value" ng-if="params.paramType === 'Restricted'" ng-model="params.paramVal" required>
</td>
</tr>
</tbody>
Expand Down
5 changes: 1 addition & 4 deletions server/app/lib/utils/apiUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,7 @@ var ApiUtil = function() {

}
if(data.search){
var cryptography = new Cryptography(cryptoConfig.algorithm, cryptoConfig.password);
var encrypt=cryptography.encryptText(data.search, cryptoConfig.encryptionEncoding,cryptoConfig.decryptionEncoding);
var decrypt=cryptography.decryptText(encrypt, cryptoConfig.decryptionEncoding, cryptoConfig.encryptionEncoding);
request['search']=decrypt;
request['search']=data.search;
}
if (typeof callback === 'function') {
callback(null, request);
Expand Down
17 changes: 0 additions & 17 deletions server/app/routes/v1.0/routes_bots.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,6 @@ module.exports.setRoutes = function(app, sessionVerificationFunc) {
scriptParams: req.body.scriptParams
}
}
/*var paramOptions = {
cookbookAttributes: req.body.cookbookAttributes,
scriptParams: req.body.scriptParams
};

if (paramOptions.scriptParams && paramOptions.scriptParams.length) {
var cryptoConfig = appConfig.cryptoSettings;
var cryptography = new Cryptography(cryptoConfig.algorithm, cryptoConfig.password);
var encryptedParams = [];
for (var i = 0; i < paramOptions.scriptParams.length; i++) {
var encryptedText = cryptography.encryptText(paramOptions.scriptParams[i], cryptoConfig.encryptionEncoding,
cryptoConfig.decryptionEncoding);
encryptedParams.push(encryptedText);
}
paramOptions.scriptParams = encryptedParams;
}
reqBody.paramOptions=paramOptions;*/
}
if(reqBody !== null) {
botsService.executeBots(req.params.botId, reqBody, function (err, data) {
Expand Down
63 changes: 34 additions & 29 deletions server/app/services/botsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,40 +388,45 @@ function filterScriptBotsData(data,callback){
var botsList = [];
var cryptoConfig = appConfig.cryptoSettings;
var cryptography = new Cryptography(cryptoConfig.algorithm, cryptoConfig.password);
for(var i = 0; i < data.docs.length; i++){
(function(bots){
if ((bots.botLinkedSubCategory === 'script')
&& ('scriptDetails' in bots.botConfig)
&& (bots.botConfig.scriptDetails.length > 0)) {
var scriptCount = 0;
for (var j = 0; j < bots.botConfig.scriptDetails.length; j++) {
(function (scriptBot) {
if (scriptBot.scriptParameters.length > 0) {
scriptCount++;
for (var k = 0; k < scriptBot.scriptParameters.length; k++) {
if(scriptBot.scriptParameters[k].paramType === '' || scriptBot.scriptParameters[k].paramType === 'Default' || scriptBot.scriptParameters[k].paramType === 'Password'){
scriptBot.scriptParameters[k].paramVal = cryptography.decryptText(scriptBot.scriptParameters[k].paramVal, cryptoConfig.decryptionEncoding,
cryptoConfig.encryptionEncoding);
}else {
scriptBot.scriptParameters[k].paramVal = '';
if(data.docs.length === 0){
callback(null,data);
return;
}else {
for (var i = 0; i < data.docs.length; i++) {
(function (bots) {
if ((bots.botLinkedSubCategory === 'script')
&& ('scriptDetails' in bots.botConfig)
&& (bots.botConfig.scriptDetails.length > 0)) {
var scriptCount = 0;
for (var j = 0; j < bots.botConfig.scriptDetails.length; j++) {
(function (scriptBot) {
if (scriptBot.scriptParameters.length > 0) {
scriptCount++;
for (var k = 0; k < scriptBot.scriptParameters.length; k++) {
if (scriptBot.scriptParameters[k].paramType === '' || scriptBot.scriptParameters[k].paramType === 'Default' || scriptBot.scriptParameters[k].paramType === 'Password') {
scriptBot.scriptParameters[k].paramVal = cryptography.decryptText(scriptBot.scriptParameters[k].paramVal, cryptoConfig.decryptionEncoding,
cryptoConfig.encryptionEncoding);
} else {
scriptBot.scriptParameters[k].paramVal = '';
}
}
} else {
scriptCount++;
}
} else {
scriptCount++;
}
})(bots.botConfig.scriptDetails[j]);
}
if(scriptCount === bots.botConfig.scriptDetails.length) {
})(bots.botConfig.scriptDetails[j]);
}
if (scriptCount === bots.botConfig.scriptDetails.length) {
botsList.push(bots);
}
} else {
botsList.push(bots);
}
} else {
botsList.push(bots);
})(data.docs[i]);
if (botsList.length === data.docs.length) {
data.docs = botsList;
callback(null, data);
return;
}
})(data.docs[i]);
if(botsList.length === data.docs.length){
data.docs = botsList;
callback(null,data);
return;
}
}
}
Expand Down