Autolock UI
This commit is contained in:
@@ -380,7 +380,6 @@ class AccountMenu {
|
||||
passcodeManager.getAutoLockInterval().then((interval) => {
|
||||
$timeout(() => {
|
||||
$scope.selectedAutoLockInterval = interval;
|
||||
console.log("selectedAutoLockInterval", $scope.selectedAutoLockInterval);
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -407,10 +406,10 @@ class AccountMenu {
|
||||
return;
|
||||
}
|
||||
|
||||
let fn = $scope.formData.changingPasscode ? passcodeManager.changePasscode : passcodeManager.setPasscode;
|
||||
let fn = $scope.formData.changingPasscode ? passcodeManager.changePasscode.bind(passcodeManager) : passcodeManager.setPasscode.bind(passcodeManager);
|
||||
|
||||
fn(passcode, () => {
|
||||
$timeout(function(){
|
||||
$timeout(() => {
|
||||
$scope.formData.showPasscodeForm = false;
|
||||
var offline = authManager.offline();
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
class PasscodeManager {
|
||||
|
||||
constructor(authManager, storageManager) {
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
document.addEventListener('visibilitychange', (e) => {
|
||||
console.log("visibilitychange", e, document.visibilityState);
|
||||
this.documentVisibilityChanged(document.visibilityState);
|
||||
});
|
||||
|
||||
@@ -13,6 +14,7 @@ class PasscodeManager {
|
||||
|
||||
const MillisecondsPerSecond = 1000;
|
||||
PasscodeManager.AutoLockIntervalNone = 0;
|
||||
PasscodeManager.AutoLockIntervalFiveSecs = 5 * MillisecondsPerSecond;
|
||||
PasscodeManager.AutoLockIntervalOneMinute = 60 * MillisecondsPerSecond;
|
||||
PasscodeManager.AutoLockIntervalFiveMinutes = 300 * MillisecondsPerSecond;
|
||||
PasscodeManager.AutoLockIntervalOneHour = 3600 * MillisecondsPerSecond;
|
||||
@@ -26,6 +28,10 @@ class PasscodeManager {
|
||||
value: PasscodeManager.AutoLockIntervalNone,
|
||||
label: "None"
|
||||
},
|
||||
{
|
||||
value: PasscodeManager.AutoLockIntervalFiveSecs,
|
||||
label: "5 Secs"
|
||||
},
|
||||
{
|
||||
value: PasscodeManager.AutoLockIntervalOneMinute,
|
||||
label: "1 Min"
|
||||
@@ -51,20 +57,21 @@ class PasscodeManager {
|
||||
}
|
||||
|
||||
async beginAutoLockTimer() {
|
||||
console.log("beginAutoLockTimer");
|
||||
var interval = await this.getAutoLockInterval();
|
||||
if(interval == PasscodeManager.AutoLockIntervalNone) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.lockTimeout = setTimeout(() => {
|
||||
this.lockApplication();
|
||||
}, interval);
|
||||
}
|
||||
|
||||
cancelAutoLockTimer() {
|
||||
console.log("cancelAutoLockTimer");
|
||||
clearTimeout(this.lockTimeout);
|
||||
}
|
||||
|
||||
lockApplication() {
|
||||
console.log("lockApplication");
|
||||
window.location.reload();
|
||||
this.cancelAutoLockTimer();
|
||||
}
|
||||
@@ -82,14 +89,16 @@ class PasscodeManager {
|
||||
}
|
||||
|
||||
async setAutoLockInterval(interval) {
|
||||
console.log("Set autolock interval", interval);
|
||||
return this.storageManager.setItem(PasscodeManager.AutoLockIntervalKey, JSON.stringify(interval), StorageManager.Fixed);
|
||||
}
|
||||
|
||||
async getAutoLockInterval() {
|
||||
let interval = await this.storageManager.getItem(PasscodeManager.AutoLockIntervalKey, StorageManager.Fixed);
|
||||
console.log("Got interval", interval);
|
||||
return interval && JSON.parse(interval);
|
||||
if(interval) {
|
||||
return JSON.parse(interval);
|
||||
} else {
|
||||
return PasscodeManager.AutoLockIntervalNone;
|
||||
}
|
||||
}
|
||||
|
||||
passcodeAuthParams() {
|
||||
|
||||
@@ -83,7 +83,7 @@ class PrivilegesManager {
|
||||
resolve(resolvedSingleton);
|
||||
}, (valueCallback) => {
|
||||
// Safe to create. Create and return object.
|
||||
var privs = new Privilege({content_type: prefsContentType});
|
||||
var privs = new SNPrivileges({content_type: prefsContentType});
|
||||
this.modelManager.addItem(privs);
|
||||
privs.setDirty(true);
|
||||
this.$rootScope.sync();
|
||||
|
||||
@@ -132,10 +132,12 @@
|
||||
%a.danger{"ng-click" => "removePasscodePressed()"} Remove Passcode
|
||||
.panel-row
|
||||
.horizontal-group
|
||||
%p Autolock:
|
||||
%h4 Autolock
|
||||
.vertical-rule
|
||||
%a.info{"ng-repeat" => "option in passcodeAutoLockOptions", "ng-click" => "selectAutoLockInterval(option.value)",
|
||||
"ng-class" => "{'info bold' : option.value == selectedAutoLockInterval}"}
|
||||
"ng-class" => "{'info boxed' : option.value == selectedAutoLockInterval}"}
|
||||
{{option.label}}
|
||||
%p The autolock timer begins when the window or tab loses focus.
|
||||
|
||||
|
||||
.panel-section{"ng-if" => "!importData.loading"}
|
||||
|
||||
@@ -22,12 +22,13 @@
|
||||
%input{"type" => "checkbox", "ng-checked" => "isCredentialRequiredForAction(action, credential)", "ng-click" => "checkboxValueChanged(action, credential)"}
|
||||
.footer
|
||||
%h2 About Privileges
|
||||
%p
|
||||
Privileges represent interface level authentication for accessing certain items and features.
|
||||
Note that when your application is unlocked, your data exists in temporary memory in an unencrypted state.
|
||||
Privileges are meant to protect against unwanted access in the event of an unlocked application, but do not affect data encryption state.
|
||||
|
||||
%p
|
||||
Privileges sync across your other devices (not including mobile); however, note that if you require
|
||||
a "Local Passcode" privilege, and another device does not have a local passcode set up, the local passcode
|
||||
requirement will be ignored on that device.
|
||||
.panel-section.no-bottom-pad
|
||||
.text-content
|
||||
%p
|
||||
Privileges represent interface level authentication for accessing certain items and features.
|
||||
Note that when your application is unlocked, your data exists in temporary memory in an unencrypted state.
|
||||
Privileges are meant to protect against unwanted access in the event of an unlocked application, but do not affect data encryption state.
|
||||
%p
|
||||
Privileges sync across your other devices (not including mobile); however, note that if you require
|
||||
a "Local Passcode" privilege, and another device does not have a local passcode set up, the local passcode
|
||||
requirement will be ignored on that device.
|
||||
|
||||
Reference in New Issue
Block a user