diff --git a/src/app/global/mainController.js b/src/app/global/mainController.js index bc9b59cb81..990f3b2a7f 100644 --- a/src/app/global/mainController.js +++ b/src/app/global/mainController.js @@ -48,30 +48,10 @@ angular $scope.$broadcast('vaultAddFolder'); }; - $scope.changeEmail = function () { - $scope.$broadcast('settingsChangeEmail'); - }; - - $scope.changePassword = function () { - $scope.$broadcast('settingsChangePassword'); - }; - - $scope.sessions = function () { - $scope.$broadcast('settingsSessions'); - }; - $scope.domains = function () { $scope.$broadcast('settingsDomains'); }; - $scope.delete = function () { - $scope.$broadcast('settingsDelete'); - }; - - $scope.twoFactor = function () { - $scope.$broadcast('settingsTwoFactor'); - }; - $scope.import = function () { $scope.$broadcast('toolsImport'); }; diff --git a/src/app/settings/settingsController.js b/src/app/settings/settingsController.js index 1de626da1d..7a7714449f 100644 --- a/src/app/settings/settingsController.js +++ b/src/app/settings/settingsController.js @@ -2,20 +2,33 @@ .module('bit.settings') .controller('settingsController', function ($scope, $uibModal, apiService, toastr, authService) { - $scope.model = {}; + $scope.model = { + profile: {}, + twoFactorEnabled: false, + email: null + }; apiService.accounts.getProfile({}, function (user) { $scope.model = { - name: user.Name, + profile: { + name: user.Name, + masterPasswordHint: user.MasterPasswordHint, + culture: user.Culture + }, email: user.Email, - masterPasswordHint: user.MasterPasswordHint, - culture: user.Culture, twoFactorEnabled: user.TwoFactorEnabled }; }); - $scope.save = function (model) { - $scope.savePromise = apiService.accounts.putProfile({}, model, function (profile) { + $scope.generalSave = function () { + $scope.generalPromise = apiService.accounts.putProfile({}, $scope.model.profile, function (profile) { + authService.setUserProfile(profile); + toastr.success('Account has been updated.', 'Success!'); + }).$promise; + }; + + $scope.passwordHintSave = function () { + $scope.passwordHintPromise = apiService.accounts.putProfile({}, $scope.model.profile, function (profile) { authService.setUserProfile(profile); toastr.success('Account has been updated.', 'Success!'); }).$promise; @@ -29,10 +42,6 @@ }); }; - $scope.$on('settingsChangePassword', function (event, args) { - $scope.changePassword(); - }); - $scope.changeEmail = function () { $uibModal.open({ animation: true, @@ -42,10 +51,6 @@ }); }; - $scope.$on('settingsChangeEmail', function (event, args) { - $scope.changeEmail(); - }); - $scope.twoFactor = function () { $uibModal.open({ animation: true, @@ -54,10 +59,6 @@ }); }; - $scope.$on('settingsTwoFactor', function (event, args) { - $scope.twoFactor(); - }); - $scope.sessions = function () { $uibModal.open({ animation: true, @@ -66,10 +67,6 @@ }); }; - $scope.$on('settingsSessions', function (event, args) { - $scope.sessions(); - }); - $scope.domains = function () { $uibModal.open({ animation: true, @@ -78,10 +75,6 @@ }); }; - $scope.$on('settingsDomains', function (event, args) { - $scope.domains(); - }); - $scope.delete = function () { $uibModal.open({ animation: true, @@ -90,8 +83,4 @@ size: 'sm' }); }; - - $scope.$on('settingsDelete', function (event, args) { - $scope.delete(); - }); }); diff --git a/src/app/settings/views/settings.html b/src/app/settings/views/settings.html index d6037e2680..0106031e62 100644 --- a/src/app/settings/views/settings.html +++ b/src/app/settings/views/settings.html @@ -9,33 +9,28 @@

General

-
+
-
+

Errors have occured

    -
  • {{e}}
  • +
  • {{e}}
-
-
- - -
-
@@ -51,10 +46,80 @@
+
+
+

Master Password

+
+
+
+
+
+
+

Errors have occured

+
    +
  • {{e}}
  • +
+
+
+ + +
+
+
+
+ +
+
+
+
+

Two-step Log In

+
+
+

+ Current Status: + ENABLED + DISABLED +

+

+ Two-step login helps keep your account more secure by requiring a code provided by an app on your mobile device + while logging in (in addition to your master password). +

+
+ +
+
+
+

Danger Zone

+
+
+ Careful, these actions are not reversible! +
+ +
\ No newline at end of file diff --git a/src/app/settings/views/settingsTwoFactor.html b/src/app/settings/views/settingsTwoFactor.html index 4ba8d18276..8cdfa7f5b4 100644 --- a/src/app/settings/views/settingsTwoFactor.html +++ b/src/app/settings/views/settingsTwoFactor.html @@ -1,13 +1,11 @@