1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

move many account settings into main settings page instead of nav menu

This commit is contained in:
Kyle Spearrin
2017-02-11 15:44:22 -05:00
parent 7373e281ac
commit 3f6637eb8f
7 changed files with 103 additions and 96 deletions

View File

@@ -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();
});
});