Wip
This commit is contained in:
@@ -84,14 +84,14 @@ angular.module('app')
|
|||||||
syncManager.loadLocalItems().then(() => {
|
syncManager.loadLocalItems().then(() => {
|
||||||
$timeout(() => {
|
$timeout(() => {
|
||||||
$scope.allTag.didLoad = true;
|
$scope.allTag.didLoad = true;
|
||||||
$rootScope.$broadcast("initial-data-loaded");
|
$rootScope.$broadcast("initial-data-loaded"); // This needs to be processed first before sync is called so that singletonManager observers function properly.
|
||||||
})
|
|
||||||
|
|
||||||
syncManager.sync();
|
syncManager.sync();
|
||||||
// refresh every 30s
|
// refresh every 30s
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
syncManager.sync();
|
syncManager.sync();
|
||||||
}, 30000);
|
}, 30000);
|
||||||
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
authManager.addEventHandler((event) => {
|
authManager.addEventHandler((event) => {
|
||||||
|
|||||||
15
app/assets/javascripts/app/directives/functional/snEnter.js
Normal file
15
app/assets/javascripts/app/directives/functional/snEnter.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
angular
|
||||||
|
.module('app')
|
||||||
|
.directive('snEnter', function() {
|
||||||
|
return function(scope, element, attrs) {
|
||||||
|
element.bind("keydown keypress", function(event) {
|
||||||
|
if(event.which === 13) {
|
||||||
|
scope.$apply(function(){
|
||||||
|
scope.$eval(attrs.snEnter, {'event': event});
|
||||||
|
});
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
});
|
||||||
@@ -170,6 +170,8 @@ class AccountMenu {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$scope.openPrivilegesModal = async function() {
|
$scope.openPrivilegesModal = async function() {
|
||||||
|
$scope.close();
|
||||||
|
|
||||||
let run = () => {
|
let run = () => {
|
||||||
$timeout(() => {
|
$timeout(() => {
|
||||||
privilegesManager.presentPrivilegesManagementModal();
|
privilegesManager.presentPrivilegesManagementModal();
|
||||||
|
|||||||
@@ -61,7 +61,23 @@ class PrivilegesAuthModal {
|
|||||||
}) != null;
|
}) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.validate = function() {
|
||||||
|
var failed = [];
|
||||||
|
for(var cred of $scope.requiredCredentials) {
|
||||||
|
var value = $scope.authenticationParameters[cred];
|
||||||
|
if(!value || value.length == 0) {
|
||||||
|
failed.push(cred);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.failedCredentials = failed;
|
||||||
|
return failed.length == 0;
|
||||||
|
}
|
||||||
|
|
||||||
$scope.submit = function() {
|
$scope.submit = function() {
|
||||||
|
if(!$scope.validate()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
privilegesManager.authenticateAction($scope.action, $scope.authenticationParameters).then((result) => {
|
privilegesManager.authenticateAction($scope.action, $scope.authenticationParameters).then((result) => {
|
||||||
$timeout(() => {
|
$timeout(() => {
|
||||||
if(result.success) {
|
if(result.success) {
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ class AuthManager extends SFAuthManager {
|
|||||||
|
|
||||||
let contentTypePredicate = new SFPredicate("content_type", "=", prefsContentType);
|
let contentTypePredicate = new SFPredicate("content_type", "=", prefsContentType);
|
||||||
this.singletonManager.registerSingleton([contentTypePredicate], (resolvedSingleton) => {
|
this.singletonManager.registerSingleton([contentTypePredicate], (resolvedSingleton) => {
|
||||||
|
// console.log("Loaded existing user prefs", resolvedSingleton.uuid);
|
||||||
this.userPreferences = resolvedSingleton;
|
this.userPreferences = resolvedSingleton;
|
||||||
this.userPreferencesDidChange();
|
this.userPreferencesDidChange();
|
||||||
}, (valueCallback) => {
|
}, (valueCallback) => {
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ class PrivilegesManager {
|
|||||||
if(!this.privileges.content.desktopPrivileges) {
|
if(!this.privileges.content.desktopPrivileges) {
|
||||||
this.privileges.content.desktopPrivileges = {};
|
this.privileges.content.desktopPrivileges = {};
|
||||||
}
|
}
|
||||||
|
console.log("Resolved existing privs", resolvedSingleton.uuid);
|
||||||
resolve(resolvedSingleton);
|
resolve(resolvedSingleton);
|
||||||
}, (valueCallback) => {
|
}, (valueCallback) => {
|
||||||
// Safe to create. Create and return object.
|
// Safe to create. Create and return object.
|
||||||
@@ -128,6 +129,7 @@ class PrivilegesManager {
|
|||||||
privs.setDirty(true);
|
privs.setDirty(true);
|
||||||
this.$rootScope.sync();
|
this.$rootScope.sync();
|
||||||
valueCallback(privs);
|
valueCallback(privs);
|
||||||
|
console.log("Creating new privs", privs.uuid);
|
||||||
resolve(privs);
|
resolve(privs);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -104,7 +104,6 @@ class SingletonManager {
|
|||||||
var singleton = allExtantItemsMatchingPredicate[0];
|
var singleton = allExtantItemsMatchingPredicate[0];
|
||||||
singletonHandler.singleton = singleton;
|
singletonHandler.singleton = singleton;
|
||||||
singletonHandler.resolutionCallback(singleton);
|
singletonHandler.resolutionCallback(singleton);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -7,12 +7,13 @@
|
|||||||
%h1.title Authentication Required
|
%h1.title Authentication Required
|
||||||
%a.close-button.info{"ng-click" => "cancel()"} Cancel
|
%a.close-button.info{"ng-click" => "cancel()"} Cancel
|
||||||
.content
|
.content
|
||||||
%form.panel-section{"ng-submit" => "submit()"}
|
.panel-section
|
||||||
%div{"ng-repeat" => "credential in requiredCredentials"}
|
%div{"ng-repeat" => "credential in requiredCredentials"}
|
||||||
%p
|
%p
|
||||||
%strong {{promptForCredential(credential)}}
|
%strong {{promptForCredential(credential)}}
|
||||||
%div
|
%div
|
||||||
%input{"type" => "password", "ng-model" => "authenticationParameters[credential]", "sn-autofocus" => "true", "should-focus" => "$index == 0"}
|
%input{"type" => "password", "ng-model" => "authenticationParameters[credential]",
|
||||||
|
"sn-autofocus" => "true", "should-focus" => "$index == 0", "sn-enter" => "submit()"}
|
||||||
%div
|
%div
|
||||||
%label.danger{"ng-if" => "isCredentialInFailureState(credential)"} Invalid authentication. Please try again.
|
%label.danger{"ng-if" => "isCredentialInFailureState(credential)"} Invalid authentication. Please try again.
|
||||||
.panel-row
|
.panel-row
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
%td
|
%td
|
||||||
%p {{displayInfoForAction(action)}}
|
%p {{displayInfoForAction(action)}}
|
||||||
%th{"ng-repeat" => "credential in availableCredentials"}
|
%th{"ng-repeat" => "credential in availableCredentials"}
|
||||||
%input{"type" => "checkbox", "ng-checked" => "isCredentialRequiredForAction(action, credential)", "ng-click" => "checkboxValueChanged(action, credential)"}
|
%input{"type" => "checkbox", "ng-disabled" => "!credentialDisplayInfo[credential].availability", "ng-checked" => "isCredentialRequiredForAction(action, credential)", "ng-click" => "checkboxValueChanged(action, credential)"}
|
||||||
|
|
||||||
.panel-section{"ng-if" => "sessionExpirey && !sessionExpired"}
|
.panel-section{"ng-if" => "sessionExpirey && !sessionExpired"}
|
||||||
%p You will not be asked to authenticate until {{sessionExpirey}}.
|
%p You will not be asked to authenticate until {{sessionExpirey}}.
|
||||||
|
|||||||
Reference in New Issue
Block a user