diff --git a/app/assets/javascripts/app/directives/views/privilegesManagementModal.js b/app/assets/javascripts/app/directives/views/privilegesManagementModal.js index c9642b357..bec8691d4 100644 --- a/app/assets/javascripts/app/directives/views/privilegesManagementModal.js +++ b/app/assets/javascripts/app/directives/views/privilegesManagementModal.js @@ -14,17 +14,20 @@ class PrivilegesManagementModal { } } - controller($scope, privilegesManager, passcodeManager, $timeout) { + controller($scope, privilegesManager, passcodeManager, authManager, $timeout) { 'ngInject'; $scope.dummy = {}; $scope.hasPasscode = passcodeManager.hasPasscode(); + $scope.hasAccount = !authManager.offline(); $scope.displayInfoForCredential = function(credential) { let info = privilegesManager.displayInfoForCredential(credential); if(credential == PrivilegesManager.CredentialLocalPasscode) { info["availability"] = $scope.hasPasscode; + } else if(credential == PrivilegesManager.CredentialAccountPassword) { + info["availability"] = $scope.hasAccount; } else { info["availability"] = true; } @@ -69,7 +72,6 @@ class PrivilegesManagementModal { } $scope.checkboxValueChanged = function(action, credential) { - console.log("toggleCredentialForAction", action, credential); $scope.privileges.toggleCredentialForAction(action, credential); privilegesManager.savePrivileges(); } diff --git a/app/assets/javascripts/app/services/privilegesManager.js b/app/assets/javascripts/app/services/privilegesManager.js index 5e695a030..817b48219 100644 --- a/app/assets/javascripts/app/services/privilegesManager.js +++ b/app/assets/javascripts/app/services/privilegesManager.js @@ -30,9 +30,9 @@ class PrivilegesManager { PrivilegesManager.SessionLengthOneWeek = 604800; this.availableActions = [ + PrivilegesManager.ActionManagePrivileges, PrivilegesManager.ActionManageExtensions, PrivilegesManager.ActionManageBackups, - PrivilegesManager.ActionManagePrivileges, PrivilegesManager.ActionManagePasscode, PrivilegesManager.ActionViewLockedNotes, PrivilegesManager.ActionDeleteNote @@ -61,6 +61,10 @@ class PrivilegesManager { } presentPrivilegesModal(action, onSuccess, onCancel) { + if(this.authenticationInProgress()) { + onCancel && onCancel(); + return; + } let customSuccess = () => { onSuccess && onSuccess(); diff --git a/app/assets/templates/directives/account-menu.html.haml b/app/assets/templates/directives/account-menu.html.haml index 81ef1ce88..5eb144c6d 100644 --- a/app/assets/templates/directives/account-menu.html.haml +++ b/app/assets/templates/directives/account-menu.html.haml @@ -87,7 +87,7 @@ %a.panel-row.condensed{"ng-click" => "openPasswordWizard('change-pw')"} Change Password - %a.panel-row.condensed{"ng-click" => "openPrivilegesModal('')"} + %a.panel-row.condensed{"ng-show" => "user", "ng-click" => "openPrivilegesModal('')"} Manage Privileges %a.panel-row.justify-left.condensed.success{"ng-if" => "securityUpdateAvailable", "ng-click" => "openPasswordWizard('upgrade-security')"} .inline.circle.small.success.mr-8 @@ -114,6 +114,7 @@ %p Adding a passcode is not supported in temporary sessions. Please sign out, then sign back in with the "Stay signed in" option checked. %form{"ng-if" => "formData.showPasscodeForm", "ng-submit" => "submitPasscodeForm()"} + .panel-row %input.form-control{:type => 'password', "ng-model" => "formData.passcode", "placeholder" => "Passcode", "sn-autofocus" => "true", "should-focus" => "true"} %input.form-control{:type => 'password', "ng-model" => "formData.confirmPasscode", "placeholder" => "Confirm Passcode"} .button-group.stretch.panel-row.form-submit @@ -138,6 +139,8 @@ {{option.label}} %p The autolock timer begins when the window or tab loses focus. + %a.panel-row.condensed{"ng-show" => "!user", "ng-click" => "openPrivilegesModal('')"} + Manage Privileges .panel-section{"ng-if" => "!importData.loading"} %h3.title Data Backups