1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01:00

telemetry events

This commit is contained in:
Kyle Spearrin 2017-04-26 10:21:06 -04:00
parent b0d2374960
commit 90b0f3201e
12 changed files with 35 additions and 16 deletions

View File

@ -1,7 +1,7 @@
angular
.module('bit.accounts')
.controller('accountsOrganizationAcceptController', function ($scope, $state, apiService, authService, toastr) {
.controller('accountsOrganizationAcceptController', function ($scope, $state, apiService, authService, toastr, $analytics) {
$scope.state = {
name: $state.current.name,
params: $state.params
@ -26,11 +26,13 @@ angular
{
token: $state.params.token
}, function () {
$analytics.eventTrack('Accepted Invitation');
$state.go('backend.user.vault', null, { location: 'replace' }).then(function () {
toastr.success('You can access this organization once an administrator confirms your membership.' +
' We\'ll send an email when that happens.', 'Invite Accepted', { timeOut: 10000 });
});
}, function () {
$analytics.eventTrack('Failed To Accept Invitation');
$state.go('backend.user.vault', null, { location: 'replace' }).then(function () {
toastr.error('Unable to accept invitation.', 'Error');
});

View File

@ -1,11 +1,12 @@
angular
.module('bit.accounts')
.controller('accountsPasswordHintController', function ($scope, $rootScope, apiService) {
.controller('accountsPasswordHintController', function ($scope, $rootScope, apiService, $analytics) {
$scope.success = false;
$scope.submit = function (model) {
$scope.submitPromise = apiService.accounts.postPasswordHint({ email: model.email }, function () {
$analytics.eventTrack('Requested Password Hint');
$scope.success = true;
}).$promise;
};

View File

@ -1,7 +1,7 @@
angular
.module('bit.accounts')
.controller('accountsRecoverController', function ($scope, apiService, cryptoService) {
.controller('accountsRecoverController', function ($scope, apiService, cryptoService, $analytics) {
$scope.success = false;
$scope.submit = function (model) {
@ -15,6 +15,7 @@ angular
};
$scope.submitPromise = apiService.accounts.postTwoFactorRecover(request, function () {
$analytics.eventTrack('Recovered 2FA');
$scope.success = true;
}).$promise;
};

View File

@ -1,7 +1,7 @@
angular
.module('bit.global')
.controller('sideNavController', function ($scope, $state, authService, toastr) {
.controller('sideNavController', function ($scope, $state, authService, toastr, $analytics) {
$scope.$state = $state;
$scope.params = $state.params;
$scope.orgs = [];
@ -36,6 +36,7 @@ angular
return;
}
$analytics.eventTrack('View Organization From Side Nav');
$state.go('backend.org.dashboard', { orgId: org.id });
};

View File

@ -1,7 +1,8 @@
angular
.module('bit.vault')
.controller('settingsAddEditEquivalentDomainController', function ($scope, $uibModalInstance, $analytics, domainIndex, domains) {
.controller('settingsAddEditEquivalentDomainController', function ($scope, $uibModalInstance, $analytics,
domainIndex, domains) {
$analytics.eventTrack('settingsAddEditEquivalentDomainController', { category: 'Modal' });
$scope.domains = domains;

View File

@ -1,7 +1,8 @@
angular
.module('bit.settings')
.controller('settingsChangeEmailController', function ($scope, $state, apiService, $uibModalInstance, cryptoService, cipherService, authService, $q, toastr, $analytics) {
.controller('settingsChangeEmailController', function ($scope, $state, apiService, $uibModalInstance, cryptoService,
cipherService, authService, $q, toastr, $analytics) {
$analytics.eventTrack('settingsChangeEmailController', { category: 'Modal' });
var _masterPasswordHash,
_newMasterPasswordHash,

View File

@ -1,7 +1,8 @@
angular
.module('bit.settings')
.controller('settingsDeleteController', function ($scope, $state, apiService, $uibModalInstance, cryptoService, authService, toastr, $analytics) {
.controller('settingsDeleteController', function ($scope, $state, apiService, $uibModalInstance, cryptoService,
authService, toastr, $analytics) {
$analytics.eventTrack('settingsDeleteController', { category: 'Modal' });
$scope.submit = function (model) {
var request = {

View File

@ -96,6 +96,7 @@
}
return apiService.settings.putDomains(request, function (domains) {
$analytics.eventTrack('Saved Equivalent Domains');
toastr.success('Domains have been updated.', 'Success!');
}).$promise;
};

View File

@ -1,7 +1,8 @@
angular
.module('bit.settings')
.controller('settingsSessionsController', function ($scope, $state, apiService, $uibModalInstance, cryptoService, authService, toastr, $analytics) {
.controller('settingsSessionsController', function ($scope, $state, apiService, $uibModalInstance, cryptoService,
authService, toastr, $analytics) {
$analytics.eventTrack('settingsSessionsController', { category: 'Modal' });
$scope.submit = function (model) {
var request = {

View File

@ -1,7 +1,8 @@
angular
.module('bit.settings')
.controller('settingsTwoFactorController', function ($scope, apiService, $uibModalInstance, cryptoService, authService, $q, toastr, $analytics) {
.controller('settingsTwoFactorController', function ($scope, apiService, $uibModalInstance, cryptoService, authService,
$q, toastr, $analytics) {
$analytics.eventTrack('settingsTwoFactorController', { category: 'Modal' });
var _issuer = 'bitwarden',
_profile = null,
@ -41,9 +42,9 @@
key: formatString(key),
recovery: formatString(response.TwoFactorRecoveryCode),
qr: 'https://chart.googleapis.com/chart?chs=120x120&chld=L|0&cht=qr&chl=otpauth://totp/' +
_issuer + ':' + encodeURIComponent(_profile.email) +
'%3Fsecret=' + encodeURIComponent(key) +
'%26issuer=' + _issuer
_issuer + ':' + encodeURIComponent(_profile.email) +
'%3Fsecret=' + encodeURIComponent(key) +
'%26issuer=' + _issuer
};
}
@ -78,6 +79,7 @@
};
$scope.print = function (printContent) {
$analytics.eventTrack('Print Recovery Code');
var w = window.open();
w.document.write('<div style="font-size: 18px; text-align: center;"><p>bitwarden two-step login recovery code:</p>' +
'<pre>' + printContent + '</pre>');

View File

@ -1,7 +1,8 @@
angular
.module('bit.tools')
.controller('toolsExportController', function ($scope, apiService, authService, $uibModalInstance, cryptoService, cipherService, $q, toastr, $analytics) {
.controller('toolsExportController', function ($scope, apiService, authService, $uibModalInstance, cryptoService,
cipherService, $q, toastr, $analytics) {
$analytics.eventTrack('toolsExportController', { category: 'Modal' });
$scope.export = function (model) {
$scope.startedExport = true;
@ -47,7 +48,9 @@
var csvString = Papa.unparse(exportLogins);
var csvBlob = new Blob([csvString]);
if (window.navigator.msSaveOrOpenBlob) { // IE hack. ref http://msdn.microsoft.com/en-us/library/ie/hh779016.aspx
// IE hack. ref http://msdn.microsoft.com/en-us/library/ie/hh779016.aspx
if (window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveBlob(csvBlob, makeFileName());
}
else {
@ -55,7 +58,9 @@
a.href = window.URL.createObjectURL(csvBlob, { type: 'text/plain' });
a.download = makeFileName();
document.body.appendChild(a);
a.click(); // IE: "Access is denied". ref: https://connect.microsoft.com/IE/feedback/details/797361/ie-10-treats-blob-url-as-cross-origin-and-denies-access
// IE: "Access is denied".
// ref: https://connect.microsoft.com/IE/feedback/details/797361/ie-10-treats-blob-url-as-cross-origin-and-denies-access
a.click();
document.body.removeChild(a);
}

View File

@ -2,7 +2,7 @@
.module('bit.vault')
.controller('vaultController', function ($scope, $uibModal, apiService, $filter, cryptoService, authService, toastr,
cipherService, $q, $localStorage, $timeout, $rootScope, $state) {
cipherService, $q, $localStorage, $timeout, $rootScope, $state, $analytics) {
$scope.loading = true;
$scope.logins = [];
$scope.favoriteCollapsed = $localStorage.collapsedFolders && 'favorite' in $localStorage.collapsedFolders;
@ -187,6 +187,7 @@
}
apiService.logins.del({ id: login.id }, function () {
$analytics.eventTrack('Deleted Login');
removeLoginFromScopes(login);
});
};
@ -231,6 +232,7 @@
}
apiService.folders.del({ id: folder.id }, function () {
$analytics.eventTrack('Deleted Folder');
var index = $rootScope.vaultFolders.indexOf(folder);
if (index > -1) {
$rootScope.vaultFolders.splice(index, 1);