diff --git a/src/app/accounts/accountsRecoverDeleteController.js b/src/app/accounts/accountsRecoverDeleteController.js new file mode 100644 index 00000000..a6cc7bb5 --- /dev/null +++ b/src/app/accounts/accountsRecoverDeleteController.js @@ -0,0 +1,13 @@ +angular + .module('bit.accounts') + + .controller('accountsRecoverDeleteController', function ($scope, $rootScope, apiService, $analytics) { + $scope.success = false; + + $scope.submit = function (model) { + $scope.submitPromise = apiService.accounts.postDeleteRecover({ email: model.email }, function () { + $analytics.eventTrack('Started Delete Recovery'); + $scope.success = true; + }).$promise; + }; + }); diff --git a/src/app/accounts/accountsVerifyRecoverDeleteController.js b/src/app/accounts/accountsVerifyRecoverDeleteController.js new file mode 100644 index 00000000..e5a056e7 --- /dev/null +++ b/src/app/accounts/accountsVerifyRecoverDeleteController.js @@ -0,0 +1,36 @@ +angular + .module('bit.accounts') + + .controller('accountsVerifyRecoverDeleteController', function ($scope, $state, apiService, toastr, $analytics) { + if (!$state.params.userId || !$state.params.token || !$state.params.email) { + $state.go('frontend.login.info').then(function () { + toastr.error('Invalid parameters.'); + }); + return; + } + + $scope.email = $state.params.email; + + $scope.delete = function () { + if (!confirm('Are you sure you want to delete this account? This cannot be undone.')) { + return; + } + + $scope.deleting = true; + apiService.accounts.postDeleteRecoverToken({}, + { + token: $state.params.token, + userId: $state.params.userId + }, function () { + $analytics.eventTrack('Recovered Delete'); + $state.go('frontend.login.info', null, { location: 'replace' }).then(function () { + toastr.success('Your account has been deleted. You can register a new account again if you like.', + 'Success'); + }); + }, function () { + $state.go('frontend.login.info', null, { location: 'replace' }).then(function () { + toastr.error('Unable to delete account.', 'Error'); + }); + }); + }; + }); diff --git a/src/app/accounts/views/accountsRecoverDelete.html b/src/app/accounts/views/accountsRecoverDelete.html new file mode 100644 index 00000000..7e3ad4dc --- /dev/null +++ b/src/app/accounts/views/accountsRecoverDelete.html @@ -0,0 +1,39 @@ +
+ +
+ +
+
+ If your account exists ({{model.email}}) we've sent you an email with further instructions. +
+ Return to log in +
+
+
+

Errors have occurred

+
    +
  • {{e}}
  • +
+
+
+ + + +
+
+ +
+ +
+
+
+
+
diff --git a/src/app/accounts/views/accountsVerifyRecoverDelete.html b/src/app/accounts/views/accountsVerifyRecoverDelete.html new file mode 100644 index 00000000..a4589b0b --- /dev/null +++ b/src/app/accounts/views/accountsVerifyRecoverDelete.html @@ -0,0 +1,21 @@ +
+ +
+
+ Deleting account... +
+
+
+

Warning

+ This will permanently delete your account. This cannot be undone. +
+

+ You have requested to delete your bitwarden account ({{email}}). + Click the button below to confirm and proceed. +

+ +
+
+
diff --git a/src/index.html b/src/index.html index af3acd4c..b422c5ca 100644 --- a/src/index.html +++ b/src/index.html @@ -172,6 +172,8 @@ + +