mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-30 13:03:53 +01:00
update key and verify email notification
This commit is contained in:
parent
7ff79a0fdd
commit
5d81ed6a96
@ -1,7 +1,8 @@
|
|||||||
angular
|
angular
|
||||||
.module('bit.global')
|
.module('bit.global')
|
||||||
|
|
||||||
.controller('mainController', function ($scope, $state, authService, appSettings, toastr, $window, $document) {
|
.controller('mainController', function ($scope, $state, authService, appSettings, toastr, $window, $document,
|
||||||
|
cryptoService, $uibModal) {
|
||||||
var vm = this;
|
var vm = this;
|
||||||
vm.bodyClass = '';
|
vm.bodyClass = '';
|
||||||
vm.usingControlSidebar = vm.openControlSidebar = false;
|
vm.usingControlSidebar = vm.openControlSidebar = false;
|
||||||
@ -30,6 +31,7 @@ angular
|
|||||||
});
|
});
|
||||||
|
|
||||||
$scope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) {
|
$scope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) {
|
||||||
|
vm.usingEncKey = !!cryptoService.getEncKey();
|
||||||
vm.searchVaultText = null;
|
vm.searchVaultText = null;
|
||||||
|
|
||||||
if (toState.data.bodyClass) {
|
if (toState.data.bodyClass) {
|
||||||
@ -68,6 +70,18 @@ angular
|
|||||||
$scope.$broadcast('organizationGroupsAdd');
|
$scope.$broadcast('organizationGroupsAdd');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.updateKey = function () {
|
||||||
|
$uibModal.open({
|
||||||
|
animation: true,
|
||||||
|
templateUrl: 'app/settings/views/settingsUpdateKey.html',
|
||||||
|
controller: 'settingsUpdateKeyController'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.verifyEmail = function () {
|
||||||
|
// TODO: send email api
|
||||||
|
};
|
||||||
|
|
||||||
// Append dropdown menu somewhere else
|
// Append dropdown menu somewhere else
|
||||||
var bodyScrollbarWidth,
|
var bodyScrollbarWidth,
|
||||||
appendedDropdownMenu,
|
appendedDropdownMenu,
|
||||||
|
@ -119,11 +119,12 @@ angular
|
|||||||
return _setDeferred.promise;
|
return _setDeferred.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
var decodedToken = jwtHelper.decodeToken(token);
|
|
||||||
apiService.accounts.getProfile({}, function (profile) {
|
apiService.accounts.getProfile({}, function (profile) {
|
||||||
_userProfile = {
|
_userProfile = {
|
||||||
id: decodedToken.name,
|
id: profile.Id,
|
||||||
email: decodedToken.email,
|
email: profile.Email,
|
||||||
|
emailVerified: profile.EmailVerified,
|
||||||
|
premium: profile.Premium,
|
||||||
extended: {
|
extended: {
|
||||||
name: profile.Name,
|
name: profile.Name,
|
||||||
twoFactorEnabled: profile.TwoFactorEnabled,
|
twoFactorEnabled: profile.TwoFactorEnabled,
|
||||||
|
37
src/app/settings/settingsUpdateKeyController.js
Normal file
37
src/app/settings/settingsUpdateKeyController.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
angular
|
||||||
|
.module('bit.settings')
|
||||||
|
|
||||||
|
.controller('settingsUpdateKeyController', function ($scope, $state, apiService, $uibModalInstance,
|
||||||
|
cryptoService, authService, cipherService, validationService, toastr, $analytics) {
|
||||||
|
$analytics.eventTrack('settingsUpdateKeyController', { category: 'Modal' });
|
||||||
|
|
||||||
|
$scope.save = function (form) {
|
||||||
|
var encKey = cryptoService.getEncKey();
|
||||||
|
if (encKey) {
|
||||||
|
validationService.addError(form, 'MasterPasswordHash',
|
||||||
|
'You do not need to update. You are already using the new encryption key.', true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.processing = true;
|
||||||
|
var mpHash = cryptoService.hashPassword($scope.masterPassword);
|
||||||
|
$scope.savePromise = cipherService.updateKey(mpHash, function () {
|
||||||
|
$uibModalInstance.dismiss('cancel');
|
||||||
|
authService.logOut();
|
||||||
|
$analytics.eventTrack('Key Updated');
|
||||||
|
return $state.go('frontend.login.info');
|
||||||
|
}).then(function () {
|
||||||
|
toastr.success('Please log back in. If you are using other bitwarden applications, ' +
|
||||||
|
'log out and back in to those as well.', 'Key Updated', { timeOut: 10000 });
|
||||||
|
}, processError);
|
||||||
|
};
|
||||||
|
|
||||||
|
function processError() {
|
||||||
|
$uibModalInstance.dismiss('cancel');
|
||||||
|
toastr.error('Something went wrong.', 'Oh No!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.close = function () {
|
||||||
|
$uibModalInstance.dismiss('cancel');
|
||||||
|
};
|
||||||
|
});
|
53
src/app/settings/views/settingsUpdateKey.html
Normal file
53
src/app/settings/views/settingsUpdateKey.html
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<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"><i class="fa fa-key"></i> Update Encryption Key</h4>
|
||||||
|
</div>
|
||||||
|
<form name="form" ng-submit="form.$valid && save(form)" api-form="savePromise" ng-show="!processing">
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>
|
||||||
|
This is <b>NOT</b> a security notification indicating that anything is wrong or has been compromised on your
|
||||||
|
account. If interested, you can <a href="https://help.bitwarden.com" target="_blank">read more details here</a>.
|
||||||
|
</p>
|
||||||
|
<hr />
|
||||||
|
<p>
|
||||||
|
You are currently using an outdated encryption scheme. We've moved to larger encryption keys
|
||||||
|
that provide better security and access to newer features.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Updating your encryption key is quick and easy. Just type your master password below and you're done!
|
||||||
|
This update will eventually become mandatory.
|
||||||
|
</p>
|
||||||
|
<hr />
|
||||||
|
<div class="callout callout-warning">
|
||||||
|
<h4><i class="fa fa-warning"></i> Warning</h4>
|
||||||
|
After updating your encryption key, you are required to log out and back in to all bitwarden applications that you
|
||||||
|
are currently using (such as the mobile app or browser extensions). Failure to log out and back
|
||||||
|
in (which downloads your new encryption key) may result in data corruption. We will attempt to log you out
|
||||||
|
automatically, however it may be delayed.
|
||||||
|
</div>
|
||||||
|
<div class="callout callout-danger validation-errors" ng-show="form.$errors">
|
||||||
|
<h4>Errors have occurred</h4>
|
||||||
|
<ul>
|
||||||
|
<li ng-repeat="e in form.$errors">{{e}}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="form-group" show-errors>
|
||||||
|
<label for="masterPassword">Master Password</label>
|
||||||
|
<input type="password" id="masterPassword" name="MasterPasswordHash" ng-model="masterPassword" class="form-control"
|
||||||
|
required api-field />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="submit" class="btn btn-primary btn-flat">
|
||||||
|
Update Key
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<div ng-show="processing" class="modal-body text-center">
|
||||||
|
<p><i class="fa fa-cog fa-spin fa-3x"></i></p>
|
||||||
|
<p>
|
||||||
|
Please wait. We are now generating a new encryption key and reencrypting all of your data. Do not close this window.
|
||||||
|
You will be automatically logged out when this process has finished.
|
||||||
|
</p>
|
||||||
|
</div>
|
@ -135,5 +135,17 @@
|
|||||||
</section>
|
</section>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
<div class="content-wrapper" ui-view>
|
<div class="content-wrapper">
|
||||||
|
<div class="alert alert-warning alert-notification" ng-click="updateKey()" ng-if="!main.usingEncKey">
|
||||||
|
<h4><i class="fa fa-key fa-fw"></i> Update Your Encryption Key</h4>
|
||||||
|
You are currently using an outdated encryption scheme.
|
||||||
|
<a href="#" stop-click>Learn more and update now</a>.
|
||||||
|
</div>
|
||||||
|
<div class="alert alert-warning alert-notification" ng-click="verifyEmail()"
|
||||||
|
ng-if="main.usingEncKey && main.userProfile && !main.userProfile.emailVerified">
|
||||||
|
<h4><i class="fa fa-envelope fa-fw"></i> Verify Your Email</h4>
|
||||||
|
Verify your account's email address to unlock access to all features.
|
||||||
|
<a href="#" stop-click>Send verification email now</a>.
|
||||||
|
</div>
|
||||||
|
<div ui-view></div>
|
||||||
</div>
|
</div>
|
@ -206,6 +206,7 @@
|
|||||||
<script src="app/settings/settingsAddEditEquivalentDomainController.js"></script>
|
<script src="app/settings/settingsAddEditEquivalentDomainController.js"></script>
|
||||||
<script src="app/settings/settingsDeleteController.js"></script>
|
<script src="app/settings/settingsDeleteController.js"></script>
|
||||||
<script src="app/settings/settingsCreateOrganizationController.js"></script>
|
<script src="app/settings/settingsCreateOrganizationController.js"></script>
|
||||||
|
<script src="app/settings/settingsUpdateKeyController.js"></script>
|
||||||
|
|
||||||
<script src="app/tools/toolsModule.js"></script>
|
<script src="app/tools/toolsModule.js"></script>
|
||||||
<script src="app/tools/toolsController.js"></script>
|
<script src="app/tools/toolsController.js"></script>
|
||||||
|
@ -370,7 +370,9 @@ form .btn .loading-icon {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Callouts */
|
/* Callouts */
|
||||||
|
|
||||||
.callout.callout-default {
|
.callout.callout-default {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-color: darken(@gray, 10%);
|
border-color: darken(@gray, 10%);
|
||||||
@ -402,7 +404,19 @@ form .btn .loading-icon {
|
|||||||
color: @btn-default-color;
|
color: @btn-default-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Alerts */
|
||||||
|
|
||||||
|
.alert-notification {
|
||||||
|
border-radius: 0;
|
||||||
|
border-left: none;
|
||||||
|
border-right: none;
|
||||||
|
margin-bottom: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
/* Boxes */
|
/* Boxes */
|
||||||
|
|
||||||
.box > .list-group {
|
.box > .list-group {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
@ -459,7 +473,9 @@ form .btn .loading-icon {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Toastr */
|
/* Toastr */
|
||||||
|
|
||||||
#toast-container {
|
#toast-container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
||||||
@ -531,11 +547,15 @@ form .btn .loading-icon {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Typography */
|
/* Typography */
|
||||||
|
|
||||||
h1, h2, h3, h4, h5, h6 {
|
h1, h2, h3, h4, h5, h6 {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Misc */
|
/* Misc */
|
||||||
|
|
||||||
.strike {
|
.strike {
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
color: @text-muted;
|
color: @text-muted;
|
||||||
|
Loading…
Reference in New Issue
Block a user