diff --git a/awx/ui/static/js/app.js b/awx/ui/static/js/app.js index 13bec9fed3..85fdeda856 100644 --- a/awx/ui/static/js/app.js +++ b/awx/ui/static/js/app.js @@ -44,7 +44,6 @@ import {AdminsList} from 'tower/controllers/Admins'; import {UsersList, UsersAdd, UsersEdit} from 'tower/controllers/Users'; import {TeamsList, TeamsAdd, TeamsEdit} from 'tower/controllers/Teams'; import {PermissionsAdd, PermissionsList, PermissionsEdit} from 'tower/controllers/Permissions'; - import 'tower/shared/RestServices'; import 'tower/shared/api-loader'; import 'tower/shared/form-generator'; diff --git a/awx/ui/static/js/controllers/Credentials.js b/awx/ui/static/js/controllers/Credentials.js index aca4a0899d..8ce0ff3c1c 100644 --- a/awx/ui/static/js/controllers/Credentials.js +++ b/awx/ui/static/js/controllers/Credentials.js @@ -259,14 +259,23 @@ export function CredentialsAdd($scope, $rootScope, $compile, $location, $log, $r // Respond to 'Ask at runtime?' checkbox $scope.ask = function (fld, associated) { - if ($scope[fld + '_ask']) { + console.log("got here"); + debugger; + if ($scope[fld] === 'ASK') { + $scope[fld + "_ask"] = true; + } + else if ($scope[fld + '_ask']) { $scope[fld] = 'ASK'; - $scope[associated] = ''; - $scope[form.name + '_form'][associated].$setValidity('awpassmatch', true); + if (associated !== "undefined") { + $scope[associated] = ''; + $scope[form.name + '_form'][associated].$setValidity('awpassmatch', true); + } } else { $scope[fld] = ''; - $scope[associated] = ''; - $scope[form.name + '_form'][associated].$setValidity('awpassmatch', true); + if (associated !== "undefined") { + $scope[associated] = ''; + $scope[form.name + '_form'][associated].$setValidity('awpassmatch', true); + } } }; @@ -306,7 +315,7 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log, $ function setAskCheckboxes() { var fld, i; for (fld in form.fields) { - if (form.fields[fld].type === 'password' && $scope[fld] === 'ASK') { + if (form.fields[fld].type === 'sensitive' && $scope[fld] === 'ASK') { // turn on 'ask' checkbox for password fields with value of 'ASK' $("#" + fld + "-clear-btn").attr("disabled", "disabled"); $scope[fld + '_ask'] = true; @@ -546,15 +555,17 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log, $ // Respond to 'Ask at runtime?' checkbox $scope.ask = function (fld, associated) { if ($scope[fld + '_ask']) { - $("#" + fld + "-clear-btn").attr("disabled", "disabled"); - $scope[fld] = 'ASK'; - $scope[associated] = ''; - $scope[form.name + '_form'][associated].$setValidity('awpassmatch', true); + $scope[fld] = 'ASK' + if (associated !== "undefined") { + $scope[associated] = ''; + $scope[form.name + '_form'][associated].$setValidity('awpassmatch', true); + } } else { - $("#" + fld + "-clear-btn").removeAttr("disabled"); $scope[fld] = ''; - $scope[associated] = ''; - $scope[form.name + '_form'][associated].$setValidity('awpassmatch', true); + if (associated !== "undefined") { + $scope[associated] = 'ASK'; + $scope[form.name + '_form'][associated].$setValidity('awpassmatch', true); + } } }; diff --git a/awx/ui/static/js/forms/Credentials.js b/awx/ui/static/js/forms/Credentials.js index ca928faad8..c918b1ae48 100644 --- a/awx/ui/static/js/forms/Credentials.js +++ b/awx/ui/static/js/forms/Credentials.js @@ -141,7 +141,7 @@ export default }, secret_key: { label: 'Secret Key', - type: 'password', + type: 'sensitive', ngShow: "kind.value == 'aws'", awRequiredWhen: { variable: "aws_required", @@ -150,6 +150,7 @@ export default autocomplete: false, ask: false, clear: false, + hasShowInputButton: true, apiField: 'passwowrd' }, "host": { @@ -206,7 +207,7 @@ export default }, "api_key": { label: 'API Key', - type: 'password', + type: 'sensitive', ngShow: "kind.value == 'rax'", awRequiredWhen: { variable: "rackspace_required", @@ -214,34 +215,19 @@ export default }, autocomplete: false, ask: false, + hasShowInputButton: true, clear: false, - // apiField: 'passwowrd' }, "password": { label: 'Password', - type: 'password', + type: 'sensitive', ngShow: "kind.value == 'scm' || kind.value == 'vmware'", addRequired: false, editRequired: false, - ngChange: "clearPWConfirm('password_confirm')", ask: false, clear: false, - associated: 'password_confirm', - autocomplete: false, - awRequiredWhen: { - variable: "password_required", - init: false - } - }, - "password_confirm": { - label: 'Confirm Password', - type: 'password', - ngShow: "kind.value == 'scm' || kind.value == 'vmware'", - addRequired: false, - editRequired: false, - awPassMatch: true, - associated: 'password', autocomplete: false, + hasShowInputButton: true, awRequiredWhen: { variable: "password_required", init: false @@ -249,24 +235,12 @@ export default }, "ssh_password": { label: 'Password', // formally 'SSH Password' - type: 'password', + type: 'sensitive', ngShow: "kind.value == 'ssh'", - ngChange: "clearPWConfirm('ssh_password_confirm')", addRequired: false, editRequired: false, ask: true, - clear: true, - associated: 'ssh_password_confirm', - autocomplete: false - }, - "ssh_password_confirm": { - label: 'Confirm Password', // formally 'Confirm SSH password' - type: 'password', - ngShow: "kind.value == 'ssh'", - addRequired: false, - editRequired: false, - awPassMatch: true, - associated: 'ssh_password', + hasShowInputButton: true, autocomplete: false }, "ssh_key_data": { @@ -291,25 +265,14 @@ export default dataContainer: "body" }, "ssh_key_unlock": { - label: 'Key Password', - type: 'password', + label: 'Private Key Passphrase', + type: 'sensitive', ngShow: "kind.value == 'ssh' || kind.value == 'scm'", addRequired: false, editRequired: false, - ngChange: "clearPWConfirm('ssh_key_unlock_confirm')", - associated: 'ssh_key_unlock_confirm', ask: true, + hasShowInputButton: true, askShow: "kind.value == 'ssh'", // Only allow ask for machine credentials - clear: true - }, - "ssh_key_unlock_confirm": { - label: 'Confirm Key Password', - type: 'password', - ngShow: "kind.value == 'ssh' || kind.value == 'scm'", - addRequired: false, - editRequired: false, - awPassMatch: true, - associated: 'ssh_key_unlock' }, "login_method": { label: "Privilege Escalation Credentials", @@ -342,24 +305,12 @@ export default }, "sudo_password": { label: 'Sudo Password', - type: 'password', + type: 'sensitive', ngShow: "kind.value == 'ssh' && login_method == 'sudo'", addRequired: false, editRequired: false, - ngChange: "clearPWConfirm('sudo_password_confirm')", ask: true, - clear: true, - associated: 'sudo_password_confirm', - autocomplete: false - }, - "sudo_password_confirm": { - label: 'Confirm Sudo Password', - type: 'password', - ngShow: "kind.value == 'ssh' && login_method == 'sudo'", - addRequired: false, - editRequired: false, - awPassMatch: true, - associated: 'sudo_password', + hasShowInputButton: true, autocomplete: false }, "su_username": { @@ -372,24 +323,12 @@ export default }, "su_password": { label: 'Su Password', - type: 'password', + type: 'sensitive', ngShow: "kind.value == 'ssh' && login_method == 'su'", addRequired: false, editRequired: false, - ngChange: "clearPWConfirm('su_password_confirm')", ask: true, - clear: true, - associated: 'su_password_confirm', - autocomplete: false - }, - "su_password_confirm": { - label: 'Confirm Su Password', - type: 'password', - ngShow: "kind.value == 'ssh' && login_method == 'su'", - addRequired: false, - editRequired: false, - awPassMatch: true, - associated: 'su_password', + hasShowInputButton: true, autocomplete: false }, "project": { @@ -408,27 +347,14 @@ export default editRequired: false, autocomplete: false }, - "vault_password": { label: "Vault Password", - type: 'password', + type: 'sensitive', ngShow: "kind.value == 'ssh'", addRequired: false, editRequired: false, - ngChange: "clearPWConfirm('vault_password_confirm')", ask: true, - clear: true, - associated: 'vault_password_confirm', - autocomplete: false - }, - "vault_password_confirm": { - label: "Confirm Vault Password", - type: 'password', - ngShow: "kind.value == 'ssh'", - addRequired: false, - editRequired: false, - awPassMatch: true, - associated: 'vault_password', + hasShowInputButton: true, autocomplete: false } }, diff --git a/awx/ui/static/js/forms/Users.js b/awx/ui/static/js/forms/Users.js index 4d76ac4fd0..3d88c49a9f 100644 --- a/awx/ui/static/js/forms/Users.js +++ b/awx/ui/static/js/forms/Users.js @@ -83,7 +83,7 @@ export default }, password: { label: 'Password', - type: 'password', + type: 'sensitive', ngShow: 'ldap_user == false', addRequired: true, editRequired: false, @@ -93,7 +93,7 @@ export default }, password_confirm: { label: 'Confirm Password', - type: 'password', + type: 'sensitive', ngShow: 'ldap_user == false', addRequired: false, editRequired: false, diff --git a/awx/ui/static/js/helpers/Credentials.js b/awx/ui/static/js/helpers/Credentials.js index 12f54457d5..9d4c6eaec7 100644 --- a/awx/ui/static/js/helpers/Credentials.js +++ b/awx/ui/static/js/helpers/Credentials.js @@ -35,7 +35,7 @@ angular.module('CredentialsHelper', ['Utilities']) scope.aws_required = false; scope.email_required = false; scope.rackspace_required = false; - scope.sshKeyDataLabel = 'SSH Private Key'; + scope.sshKeyDataLabel = 'Private Key'; scope.username_required = false; // JT-- added username_required b/c mutliple 'kinds' need username to be required (GCE) scope.key_required = false; // JT -- doing the same for key and project scope.project_required = false; @@ -59,7 +59,7 @@ angular.module('CredentialsHelper', ['Utilities']) scope.aws_required = false; scope.email_required = false; scope.rackspace_required = false; - scope.sshKeyDataLabel = 'SSH Private Key'; + scope.sshKeyDataLabel = 'Private Key'; scope.username_required = false; // JT-- added username_required b/c mutliple 'kinds' need username to be required (GCE) scope.key_required = false; // JT -- doing the same for key and project scope.project_required = false; diff --git a/awx/ui/static/js/shared/directives.js b/awx/ui/static/js/shared/directives.js index 4e82557d69..9fa121b43c 100644 --- a/awx/ui/static/js/shared/directives.js +++ b/awx/ui/static/js/shared/directives.js @@ -403,46 +403,48 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Job * default placement to the left and delay to the config setting. */ .directive('awToolTip', ['$sce', function($sce) { - return function(scope, element, attrs) { - var delay = (attrs.delay !== undefined && attrs.delay !== null) ? attrs.delay : ($AnsibleConfig) ? $AnsibleConfig.tooltip_delay : {show: 500, hide: 100}, - placement; - if (attrs.awTipPlacement) { - placement = attrs.awTipPlacement; - } - else { - placement = (attrs.placement !== undefined && attrs.placement !== null) ? attrs.placement : 'left'; - } + return { + link: function(scope, element, attrs) { + var delay = (attrs.delay !== undefined && attrs.delay !== null) ? attrs.delay : ($AnsibleConfig) ? $AnsibleConfig.tooltip_delay : {show: 500, hide: 100}, + placement; + if (attrs.awTipPlacement) { + placement = attrs.awTipPlacement; + } + else { + placement = (attrs.placement !== undefined && attrs.placement !== null) ? attrs.placement : 'left'; + } - $(element).on('hidden.bs.tooltip', function( ) { - // TB3RC1 is leaving behind tooltip
A password with reasonable strength is required. As you type the password " + + "a progress bar will measure the strength. Sufficient strength is reached when the bar turns green.
" + + "Password strength is judged using the following:
" + + "