mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 17:23:37 +00:00
Added setting to not store key via lock options, only keeping it in memory. Fixed some i18n and created constants service
This commit is contained in:
45
src/popup/app/lock/lockController.js
Normal file
45
src/popup/app/lock/lockController.js
Normal file
@@ -0,0 +1,45 @@
|
||||
angular
|
||||
.module('bit.lock')
|
||||
|
||||
.controller('lockController', function ($scope, $state, $analytics, i18nService, loginService, cryptoService, toastr,
|
||||
userService, SweetAlert) {
|
||||
$scope.i18n = i18nService;
|
||||
$('#master-password').focus();
|
||||
|
||||
$scope.logOut = function () {
|
||||
loginService.logOut(function () {
|
||||
SweetAlert.swal({
|
||||
title: 'Log Out',
|
||||
text: 'Are you sure you want to log out?',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Yes',
|
||||
cancelButtonText: 'Cancel'
|
||||
}, function (confirmed) {
|
||||
if (confirmed) {
|
||||
loginService.logOut(function () {
|
||||
$analytics.eventTrack('Logged Out');
|
||||
$state.go('home');
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.submit = function () {
|
||||
userService.getEmail(function (email) {
|
||||
var key = cryptoService.makeKey($scope.masterPassword, email);
|
||||
cryptoService.hashPassword($scope.masterPassword, key, function (keyHash) {
|
||||
cryptoService.getKeyHash(true, function (storedKeyHash) {
|
||||
if (storedKeyHash && keyHash && storedKeyHash === keyHash) {
|
||||
cryptoService.setKey(key, function () {
|
||||
$state.go('tabs.current');
|
||||
});
|
||||
}
|
||||
else {
|
||||
toastr.error(i18nService.invalidMasterPassword, i18nService.errorsHaveOccurred);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user