From 5badea2d9d0b0fa6256533efd861476193d89c6b Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 20 Sep 2016 11:38:43 -0400 Subject: [PATCH] alerts and redirects for settings --- src/popup/app/settings/settingsController.js | 48 ++++++++++++++++++- src/popup/app/settings/settingsModule.js | 2 +- src/popup/app/settings/views/settings.html | 43 ++++------------- src/popup/app/tools/toolsController.js | 4 +- .../app/vault/vaultEditSiteController.js | 5 +- src/popup/less/plugins.less | 4 ++ 6 files changed, 65 insertions(+), 41 deletions(-) diff --git a/src/popup/app/settings/settingsController.js b/src/popup/app/settings/settingsController.js index 44fc2dde..66218fb9 100644 --- a/src/popup/app/settings/settingsController.js +++ b/src/popup/app/settings/settingsController.js @@ -1,16 +1,60 @@ angular .module('bit.settings') - .controller('settingsController', function ($scope, loginService, $state, syncService) { + .controller('settingsController', function ($scope, loginService, $state, syncService, SweetAlert) { $scope.sync = function () { syncService.fullSync(function () { alert('Sync done!'); }); }; - $scope.logOut = function (model) { + $scope.logOut = function () { loginService.logOut(function () { $state.go('login'); }); }; + + $scope.changePassword = function () { + SweetAlert.swal({ + title: 'Change Master Password', + text: 'You can change your master password on the bitwarden.com web vault. Do you want to visit the website now?', + type: 'info', + showCancelButton: true, + confirmButtonText: 'Yes', + cancelButtonText: 'Cancel' + }, alertCallback); + }; + + $scope.changeEmail = function () { + SweetAlert.swal({ + title: 'Change Email', + text: 'You can change your email address on the bitwarden.com web vault. Do you want to visit the website now?', + type: 'info', + showCancelButton: true, + confirmButtonText: 'Yes', + cancelButtonText: 'Cancel' + }, alertCallback); + }; + + $scope.twoStep = function () { + SweetAlert.swal({ + title: 'Two-step Login', + text: 'Two-step login makes your account more secure by requiring you to enter a security code from an authenticator app whenever you log in. Two-step login can be enabled on the bitwarden.com web vault. Do you want to visit the website now?', + type: 'info', + showCancelButton: true, + confirmButtonText: 'Yes', + cancelButtonText: 'Cancel' + }, alertCallback); + }; + + function alertCallback(confirmed) { + if (confirmed) { + chrome.tabs.create({ url: 'https://vault.bitwarden.com' }); + } + } + + $scope.rate = function () { + // TODO: detect which extension store to send them to + chrome.tabs.create({ url: 'https://google.com' }); + }; }); diff --git a/src/popup/app/settings/settingsModule.js b/src/popup/app/settings/settingsModule.js index efddc81e..087cba14 100644 --- a/src/popup/app/settings/settingsModule.js +++ b/src/popup/app/settings/settingsModule.js @@ -1,2 +1,2 @@ angular - .module('bit.settings', []); + .module('bit.settings', ['oitozero.ngSweetAlert']); diff --git a/src/popup/app/settings/views/settings.html b/src/popup/app/settings/views/settings.html index ed05d2b6..6feec6a6 100644 --- a/src/popup/app/settings/views/settings.html +++ b/src/popup/app/settings/views/settings.html @@ -3,36 +3,26 @@
-
-
- Current Session -
- -
Other @@ -76,7 +53,7 @@ Help & Feedback - + Rate the Extension diff --git a/src/popup/app/tools/toolsController.js b/src/popup/app/tools/toolsController.js index dea703e8..a48fe160 100644 --- a/src/popup/app/tools/toolsController.js +++ b/src/popup/app/tools/toolsController.js @@ -22,8 +22,8 @@ showCancelButton: true, confirmButtonText: 'Yes', cancelButtonText: 'Cancel' - }, function (confirm) { - if (confirm) { + }, function (confirmed) { + if (confirmed) { chrome.tabs.create({ url: 'https://vault.bitwarden.com' }); } }); diff --git a/src/popup/app/vault/vaultEditSiteController.js b/src/popup/app/vault/vaultEditSiteController.js index 019af0ed..33dd52cc 100644 --- a/src/popup/app/vault/vaultEditSiteController.js +++ b/src/popup/app/vault/vaultEditSiteController.js @@ -61,7 +61,6 @@ angular }; $scope.generatePassword = function () { - var confirmed = true; if ($scope.site.password) { SweetAlert.swal({ title: 'Warning', @@ -70,8 +69,8 @@ angular showCancelButton: true, confirmButtonText: 'Yes', cancelButtonText: 'No' - }, function (confirm) { - if (confirm) { + }, function (confirmed) { + if (confirmed) { goPasswordGenerator(); } }); diff --git a/src/popup/less/plugins.less b/src/popup/less/plugins.less index 16345bb5..3e1f530e 100644 --- a/src/popup/less/plugins.less +++ b/src/popup/less/plugins.less @@ -84,6 +84,10 @@ /* Sweet alert */ .sweet-alert { + border-radius: 0; + -webkit-border-radius: 0; + -moz-border-radius: 0; + p { color: @text-color; font-weight: normal;