mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-23 11:56:00 +01:00
move many account settings into main settings page instead of nav menu
This commit is contained in:
parent
7373e281ac
commit
3f6637eb8f
@ -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');
|
||||
};
|
||||
|
@ -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 = {
|
||||
profile: {
|
||||
name: user.Name,
|
||||
email: user.Email,
|
||||
masterPasswordHint: user.MasterPasswordHint,
|
||||
culture: user.Culture,
|
||||
culture: user.Culture
|
||||
},
|
||||
email: user.Email,
|
||||
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();
|
||||
});
|
||||
});
|
||||
|
@ -9,33 +9,28 @@
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">General</h3>
|
||||
</div>
|
||||
<form role="form" name="profileForm" ng-submit="profileForm.$valid && save(model)" api-form="savePromise">
|
||||
<form role="form" name="generalForm" ng-submit="generalForm.$valid && generalSave()" api-form="generalPromise">
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-9">
|
||||
<div class="callout callout-danger validation-errors" ng-show="profileForm.$errors">
|
||||
<div class="callout callout-danger validation-errors" ng-show="generalForm.$errors">
|
||||
<h4>Errors have occured</h4>
|
||||
<ul>
|
||||
<li ng-repeat="e in profileForm.$errors">{{e}}</li>
|
||||
<li ng-repeat="e in generalForm.$errors">{{e}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="name">Name</label>
|
||||
<input type="text" id="name" name="Name" ng-model="model.name" class="form-control"
|
||||
<input type="text" id="name" name="Name" ng-model="model.profile.name" class="form-control"
|
||||
required api-field />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email">Email - <a href="javascript:void(0)" ng-click="changeEmail()">change</a></label>
|
||||
<input type="text" id="email" ng-model="model.email" class="form-control" readonly />
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="hint">Master Password Hint</label>
|
||||
<input type="text" id="hint" name="MasterPasswordHint" ng-model="model.masterPasswordHint"
|
||||
class="form-control" api-field />
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="culture">Language/Culture</label>
|
||||
<select id="culture" name="Culture" ng-model="model.culture" class="form-control" api-field>
|
||||
<select id="culture" name="Culture" ng-model="model.profile.culture" class="form-control" api-field>
|
||||
<option value="en-US">English (US)</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -51,10 +46,80 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="profileForm.$loading">
|
||||
<i class="fa fa-refresh fa-spin loading-icon" ng-show="profileForm.$loading"></i>Save
|
||||
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="generalForm.$loading">
|
||||
<i class="fa fa-refresh fa-spin loading-icon" ng-show="generalForm.$loading"></i>Save
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Master Password</h3>
|
||||
</div>
|
||||
<form role="form" name="masterPasswordForm" ng-submit="masterPasswordForm.$valid && passwordHintSave()"
|
||||
api-form="passwordHintPromise">
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-9">
|
||||
<div class="callout callout-danger validation-errors" ng-show="masterPasswordForm.$errors">
|
||||
<h4>Errors have occured</h4>
|
||||
<ul>
|
||||
<li ng-repeat="e in masterPasswordForm.$errors">{{e}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="hint">Master Password Hint</label>
|
||||
<input type="text" id="hint" name="MasterPasswordHint" ng-model="model.profile.masterPasswordHint"
|
||||
class="form-control" api-field />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="masterPasswordForm.$loading">
|
||||
<i class="fa fa-refresh fa-spin loading-icon" ng-show="masterPasswordForm.$loading"></i>Save
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="changePassword()">
|
||||
Change Master Password
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="box box-default">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Two-step Log In</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<p>
|
||||
Current Status:
|
||||
<span class="label bg-green" ng-show="model.twoFactorEnabled">ENABLED</span>
|
||||
<span class="label bg-gray" ng-show="!model.twoFactorEnabled">DISABLED</span>
|
||||
</p>
|
||||
<p>
|
||||
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).
|
||||
</p>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="twoFactor()">
|
||||
Manage Two-step Log In
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box box-danger">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Danger Zone</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
Careful, these actions are not reversible!
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<button type="submit" class="btn btn-default btn-flat" ng-click="sessions()">
|
||||
Deauthorize Sessions
|
||||
</button>
|
||||
<button type="submit" class="btn btn-default btn-flat" ng-click="delete()">
|
||||
Delete Account
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
@ -1,11 +1,9 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="twoFactorModelLabel"><i class="fa fa-key"></i> Two-step Login</h4>
|
||||
<h4 class="modal-title" id="twoFactorModelLabel"><i class="fa fa-key"></i> Two-step Log In</h4>
|
||||
</div>
|
||||
<form name="authTwoStepForm" ng-submit="authTwoStepForm.$valid && auth(authModel)" api-form="authPromise" ng-if="!twoFactorModel">
|
||||
<div class="modal-body">
|
||||
<p>Current Status: <span class="label bg-green" ng-show="enabled()">ENABLED</span><span class="label bg-gray" ng-show="!enabled()">DISABLED</span></p>
|
||||
<p>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).</p>
|
||||
<p ng-show="enabled()">Two-step log in is already enabled on your account. To access your two-step settings enter your master password below.</p>
|
||||
<p ng-show="!enabled()">To get started with two-step log in enter your master password below.</p>
|
||||
<div class="callout callout-danger validation-errors" ng-show="authTwoStepForm.$errors">
|
||||
|
@ -21,7 +21,7 @@
|
||||
$scope.generatePassword = function () {
|
||||
if (!$scope.login.password || confirm('Are you sure you want to overwrite the current password?')) {
|
||||
$analytics.eventTrack('Generated Password From Add');
|
||||
$scope.login.password = passwordService.generatePassword({ length: 10, special: true });
|
||||
$scope.login.password = passwordService.generatePassword({ length: 12, special: true });
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
$scope.generatePassword = function () {
|
||||
if (!$scope.login.password || confirm('Are you sure you want to overwrite the current password?')) {
|
||||
$analytics.eventTrack('Generated Password From Edit');
|
||||
$scope.login.password = passwordService.generatePassword({ length: 10, special: true });
|
||||
$scope.login.password = passwordService.generatePassword({ length: 12, special: true });
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -59,36 +59,11 @@
|
||||
<li class="treeview" ng-class="{active: $state.includes('backend.settings')}">
|
||||
<a ui-sref="backend.settings"><i class="fa fa-cogs"></i> <span>Settings</span></a>
|
||||
<ul class="treeview-menu">
|
||||
<li>
|
||||
<a href="javascript:void(0)" ng-click="changePassword()">
|
||||
<i class="fa fa-circle-o"></i> Change Password
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:void(0)" ng-click="changeEmail()">
|
||||
<i class="fa fa-circle-o"></i> Change Email
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:void(0)" ng-click="sessions()">
|
||||
<i class="fa fa-circle-o"></i> Deauthorize Sessions
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:void(0)" ng-click="twoFactor()">
|
||||
<i class="fa fa-circle-o"></i> Two-step Login
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:void(0)" ng-click="domains()">
|
||||
<i class="fa fa-circle-o"></i> Domain Rules
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:void(0)" ng-click="delete()">
|
||||
<i class="fa fa-circle-o"></i> Delete Account
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="treeview" ng-class="{active: $state.includes('backend.tools')}">
|
||||
|
Loading…
Reference in New Issue
Block a user