added lock now option
This commit is contained in:
parent
4861aa0210
commit
e079b70e6a
|
@ -399,6 +399,10 @@
|
|||
"message": "Lock Options",
|
||||
"description": "Lock Options"
|
||||
},
|
||||
"lockNow": {
|
||||
"message": "Lock Now",
|
||||
"description": "Lock Now"
|
||||
},
|
||||
"immediately": {
|
||||
"message": "Immediately",
|
||||
"description": "Immediately"
|
||||
|
|
|
@ -42,4 +42,7 @@
|
|||
})
|
||||
.factory('settingsService', function () {
|
||||
return chrome.extension.getBackgroundPage().settingsService;
|
||||
})
|
||||
.factory('lockService', function () {
|
||||
return chrome.extension.getBackgroundPage().lockService;
|
||||
});
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
<option value="">{{i18n.never}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<a class="list-section-item" href="" ng-click="lock()">
|
||||
{{i18n.lockNow}}
|
||||
<i class="fa fa-chevron-right fa-lg"></i>
|
||||
</a>
|
||||
<a class="list-section-item" href="" ng-click="twoStep()">
|
||||
{{i18n.twoStepLogin}}
|
||||
<i class="fa fa-chevron-right fa-lg"></i>
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue