diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json
index 11fbd7a7ce..7963181d1d 100644
--- a/src/_locales/en/messages.json
+++ b/src/_locales/en/messages.json
@@ -399,6 +399,10 @@
"message": "Lock Options",
"description": "Lock Options"
},
+ "lockNow": {
+ "message": "Lock Now",
+ "description": "Lock Now"
+ },
"immediately": {
"message": "Immediately",
"description": "Immediately"
diff --git a/src/popup/app/services/backgroundService.js b/src/popup/app/services/backgroundService.js
index 5824eec0b4..9f2e1fc8c9 100644
--- a/src/popup/app/services/backgroundService.js
+++ b/src/popup/app/services/backgroundService.js
@@ -42,4 +42,7 @@
})
.factory('settingsService', function () {
return chrome.extension.getBackgroundPage().settingsService;
+ })
+ .factory('lockService', function () {
+ return chrome.extension.getBackgroundPage().lockService;
});
diff --git a/src/popup/app/settings/settingsController.js b/src/popup/app/settings/settingsController.js
index cf8601a7de..af02247f0f 100644
--- a/src/popup/app/settings/settingsController.js
+++ b/src/popup/app/settings/settingsController.js
@@ -2,7 +2,7 @@
.module('bit.settings')
.controller('settingsController', function ($scope, $state, SweetAlert, utilsService, $analytics,
- i18nService, constantsService, cryptoService) {
+ i18nService, constantsService, cryptoService, lockService) {
utilsService.initListSectionItemListeners($(document), angular);
$scope.lockOption = '';
$scope.i18n = i18nService;
@@ -48,6 +48,14 @@
});
};
+ $scope.lock = function () {
+ lockService.lock().then(function () {
+ return $state.go('lock', {
+ animation: 'in-slide-up'
+ });
+ });
+ };
+
$scope.logOut = function () {
SweetAlert.swal({
title: i18nService.logOut,
@@ -114,13 +122,13 @@
case 'chrome':
chrome.tabs.create({
url: 'https://chrome.google.com/webstore/detail/bitwarden-free-password-m/' +
- 'nngceckbapebfimnlniiiahkandclblb/reviews'
+ 'nngceckbapebfimnlniiiahkandclblb/reviews'
});
break;
case 'firefox':
chrome.tabs.create({
url: 'https://addons.mozilla.org/en-US/firefox/addon/' +
- 'bitwarden-password-manager/#reviews'
+ 'bitwarden-password-manager/#reviews'
});
break;
case 'edge':
@@ -129,7 +137,7 @@
case 'opera':
chrome.tabs.create({
url: 'https://addons.opera.com/en/extensions/details/' +
- 'bitwarden-free-password-manager/#feedback-container'
+ 'bitwarden-free-password-manager/#feedback-container'
});
break;
default:
diff --git a/src/popup/app/settings/views/settings.html b/src/popup/app/settings/views/settings.html
index 9f832fa50e..a90bfe0941 100644
--- a/src/popup/app/settings/views/settings.html
+++ b/src/popup/app/settings/views/settings.html
@@ -23,6 +23,10 @@
+
+ {{i18n.lockNow}}
+
+
{{i18n.twoStepLogin}}
diff --git a/src/services/lockService.js b/src/services/lockService.js
index e87101d3f8..1b74504214 100644
--- a/src/services/lockService.js
+++ b/src/services/lockService.js
@@ -50,7 +50,7 @@ function initLockService(self) {
var diffSeconds = ((new Date()).getTime() - lastActive) / 1000;
if (diffSeconds >= lockOptionSeconds) {
// need to lock now
- self.lock();
+ return self.lock();
}
});
}
@@ -59,16 +59,18 @@ function initLockService(self) {
chrome.idle.onStateChanged.addListener(function (newState) {
if (newState === 'locked') {
getLockOption().then(function (lockOption) {
- if (lockOption === -2) {
- self.lock();
+ if (lockOption !== -2) {
+ return;
}
+
+ return self.lock();
});
}
});
}
LockService.prototype.lock = function () {
- Q.all([
+ return Q.all([
self.cryptoService.clearKey(),
self.cryptoService.clearOrgKeys(true),
self.cryptoService.clearPrivateKey(true)