Wip
This commit is contained in:
@@ -84,14 +84,14 @@ angular.module('app')
|
||||
syncManager.loadLocalItems().then(() => {
|
||||
$timeout(() => {
|
||||
$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();
|
||||
// refresh every 30s
|
||||
setInterval(function () {
|
||||
syncManager.sync();
|
||||
}, 30000);
|
||||
})
|
||||
|
||||
syncManager.sync();
|
||||
// refresh every 30s
|
||||
setInterval(function () {
|
||||
syncManager.sync();
|
||||
}, 30000);
|
||||
});
|
||||
|
||||
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.close();
|
||||
|
||||
let run = () => {
|
||||
$timeout(() => {
|
||||
privilegesManager.presentPrivilegesManagementModal();
|
||||
|
||||
@@ -61,7 +61,23 @@ class PrivilegesAuthModal {
|
||||
}) != 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() {
|
||||
if(!$scope.validate()) {
|
||||
return;
|
||||
}
|
||||
privilegesManager.authenticateAction($scope.action, $scope.authenticationParameters).then((result) => {
|
||||
$timeout(() => {
|
||||
if(result.success) {
|
||||
|
||||
@@ -135,6 +135,7 @@ class AuthManager extends SFAuthManager {
|
||||
|
||||
let contentTypePredicate = new SFPredicate("content_type", "=", prefsContentType);
|
||||
this.singletonManager.registerSingleton([contentTypePredicate], (resolvedSingleton) => {
|
||||
// console.log("Loaded existing user prefs", resolvedSingleton.uuid);
|
||||
this.userPreferences = resolvedSingleton;
|
||||
this.userPreferencesDidChange();
|
||||
}, (valueCallback) => {
|
||||
|
||||
@@ -120,6 +120,7 @@ class PrivilegesManager {
|
||||
if(!this.privileges.content.desktopPrivileges) {
|
||||
this.privileges.content.desktopPrivileges = {};
|
||||
}
|
||||
console.log("Resolved existing privs", resolvedSingleton.uuid);
|
||||
resolve(resolvedSingleton);
|
||||
}, (valueCallback) => {
|
||||
// Safe to create. Create and return object.
|
||||
@@ -128,6 +129,7 @@ class PrivilegesManager {
|
||||
privs.setDirty(true);
|
||||
this.$rootScope.sync();
|
||||
valueCallback(privs);
|
||||
console.log("Creating new privs", privs.uuid);
|
||||
resolve(privs);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -104,7 +104,6 @@ class SingletonManager {
|
||||
var singleton = allExtantItemsMatchingPredicate[0];
|
||||
singletonHandler.singleton = singleton;
|
||||
singletonHandler.resolutionCallback(singleton);
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -7,12 +7,13 @@
|
||||
%h1.title Authentication Required
|
||||
%a.close-button.info{"ng-click" => "cancel()"} Cancel
|
||||
.content
|
||||
%form.panel-section{"ng-submit" => "submit()"}
|
||||
.panel-section
|
||||
%div{"ng-repeat" => "credential in requiredCredentials"}
|
||||
%p
|
||||
%strong {{promptForCredential(credential)}}
|
||||
%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
|
||||
%label.danger{"ng-if" => "isCredentialInFailureState(credential)"} Invalid authentication. Please try again.
|
||||
.panel-row
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
%td
|
||||
%p {{displayInfoForAction(action)}}
|
||||
%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"}
|
||||
%p You will not be asked to authenticate until {{sessionExpirey}}.
|
||||
|
||||
Reference in New Issue
Block a user