Skip to content

Commit 097c75c

Browse files
authored
Merge pull request #4861 from Countly/ar2rsawseen/master
[account-settings] allow generating new api key
2 parents 4685949 + 06f6893 commit 097c75c

File tree

5 files changed

+41
-5
lines changed

5 files changed

+41
-5
lines changed

plugins/plugins/frontend/public/javascripts/countly.views.js

+28-1
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,15 @@
997997
this.components[allComponents[i]._id] = allComponents[i];
998998
}
999999
}
1000+
},
1001+
//generate API key which is a random string 32 chars long
1002+
generateAPIKey: function() {
1003+
var text = "";
1004+
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
1005+
for (var i = 0; i < 32; i++) {
1006+
text += possible.charAt(Math.floor(Math.random() * possible.length));
1007+
}
1008+
return text;
10001009
}
10011010
}
10021011
});
@@ -1191,7 +1200,25 @@
11911200
};
11921201
if (countlyAuth.validateGlobalAdmin()) {
11931202
if (countlyGlobal.plugins.indexOf("drill") !== -1) {
1194-
showInAppManagment.drill = {"big_list_limit": true, "record_big_list": true, "cache_threshold": true, "correct_estimation": true, "custom_property_limit": true, "list_limit": true, "projection_limit": true, "record_actions": true, "record_crashes": true, "record_meta": true, "record_pushes": true, "record_sessions": true, "record_star_rating": true, "record_apm": true, "record_views": true};
1203+
showInAppManagment.drill = {
1204+
"big_list_limit": true,
1205+
"record_big_list": true,
1206+
"cache_threshold": true,
1207+
"correct_estimation": true,
1208+
"custom_property_limit": true,
1209+
"list_limit": true,
1210+
"projection_limit": true,
1211+
"record_actions": true,
1212+
"record_crashes": true,
1213+
"record_meta": true,
1214+
"record_pushes": true,
1215+
"record_pushes_sent": true,
1216+
"record_sessions": true,
1217+
"record_star_rating": true,
1218+
"record_apm": true,
1219+
"record_consent": true,
1220+
"record_views": true
1221+
};
11951222
}
11961223
if (countlyGlobal.plugins.includes("logger")) {
11971224
showInAppManagment.logger = {"state": true, "limit": true};

plugins/plugins/frontend/public/localization/plugins.properties

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ configs.changed = Settings changed
5050
configs.saved = Changes were successfully saved
5151
configs.frontend = Frontend
5252
configs.api = API
53+
configs.regenerate = Regenerate
5354
configs.logger = Incoming Data Logs
5455
configs.apps = Apps
5556
configs.logs = Logs

plugins/plugins/frontend/public/stylesheets/main.scss

100755100644
+6
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,9 @@
7272
}
7373
}
7474
}
75+
76+
.apikey {
77+
.el-input {
78+
width: 320px;
79+
}
80+
}

plugins/plugins/frontend/public/templates/account-settings.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ <h3 class="bu-mb-4"> {{i18n('plugins.user-configs')}} &nbsp;</h3>
2121
<cly-inline-form-field rules="required" :label="i18n('management-users.full-name')" prop="full_name">
2222
<el-input :placeholder="i18n('management-users.full-name')" v-model="formScope.editedObject.full_name" @input="nameChanged"></el-input>
2323
</cly-inline-form-field>
24-
<cly-inline-form-field rules="required" :label="i18n('user-settings.api-key')" prop="api_key">
25-
<el-input :placeholder="i18n('user-settings.api-key')" v-model="formScope.editedObject.api_key"></el-input>
24+
<cly-inline-form-field rules="required" :label="i18n('user-settings.api-key')" prop="api_key" class="apikey">
25+
<el-input :placeholder="i18n('user-settings.api-key')" v-model="formScope.editedObject.api_key" readonly></el-input>
26+
<el-button @click="formScope.editedObject.api_key = generateAPIKey()">{{i18n('configs.regenerate')}}</el-button>
2627
</cly-inline-form-field>
2728
<cly-inline-form-field :label="i18n('management-users.password')">
2829
<el-button @click="changePassword.showDialog = true">{{i18n('user-settings.change-password')}}</el-button>

plugins/push/api/jobs/util/resultor.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -514,14 +514,15 @@ class Resultor extends DoFinish {
514514

515515
this.log.d('Recording %d [CLY]_push_sent\'s: %j', sent, params);
516516
require('../../../../../api/parts/data/events').processEvents(params);
517+
//plugins.dispatch("/plugins/drill", {params: params, dbAppUser: params.app_user, events: params.qstring.events});
517518

518-
/*try {
519+
try {
519520
this.log.d('Recording %d data points', sent);
520521
require('../../../../server-stats/api/parts/stats').updateDataPoints(common.writeBatcher, app._id, 0, {"p": sent});
521522
}
522523
catch (e) {
523524
this.log.d('Error during dp recording', e);
524-
}*/
525+
}
525526
this.sentUsers[aid][mid][p] = 0;
526527
}
527528
});

0 commit comments

Comments
 (0)