1
0
mirror of https://github.com/bitwarden/web synced 2025-12-10 21:33:16 +00:00

Added analytics telemetry throughout the application. Make sure angulartics bundles before the ga dependency.

This commit is contained in:
Kyle Spearrin
2016-08-11 20:43:05 -04:00
parent ffbf25b62f
commit 92e0537bed
18 changed files with 76 additions and 23 deletions

View File

@@ -1,7 +1,8 @@
angular
.module('bit.settings')
.controller('settingsTwoFactorController', function ($scope, apiService, $uibModalInstance, cryptoService, authService, $q, toastr) {
.controller('settingsTwoFactorController', function ($scope, apiService, $uibModalInstance, cryptoService, authService, $q, toastr, $analytics) {
$analytics.eventTrack('settingsTwoFactorController', { category: 'Modal' });
var _issuer = 'bitwarden',
_profile = authService.getUserProfile(),
_masterPasswordHash;
@@ -39,15 +40,17 @@
var request = {
enabled: !currentlyEnabled,
token: model ? model.token : null,
masterPasswordHash: _masterPasswordHash,
masterPasswordHash: _masterPasswordHash
};
$scope.updatePromise = apiService.accounts.putTwoFactor({}, request, function (response) {
if (response.TwoFactorEnabled) {
$analytics.eventTrack('Enabled Two-step Login');
toastr.success('Two-step login has been enabled.');
if (_profile.extended) _profile.extended.twoFactorEnabled = true;
}
else {
$analytics.eventTrack('Disabled Two-step Login');
toastr.success('Two-step login has been disabled.');
if (_profile.extended) _profile.extended.twoFactorEnabled = false;
}