1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-30 22:21:13 +03:00

Tweaks to the ux for saved creds

This commit is contained in:
mabashian 2019-08-29 16:59:54 -04:00 committed by Ryan Petrello
parent 2474a3a2ea
commit 53925f5e98
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777
2 changed files with 22 additions and 12 deletions

View File

@ -7,9 +7,9 @@
import {N_} from "../i18n";
export default
['Wait', '$state', '$scope', '$rootScope', 'ProcessErrors', 'CheckLicense', 'moment', 'Rest',
['Wait', '$state', '$scope', '$rootScope', 'ProcessErrors', 'CheckLicense', 'moment', 'Rest', '$timeout',
'$window', 'ConfigService', 'pendoService', 'insightsEnablementService', 'i18n', 'config', 'GetBasePath',
function(Wait, $state, $scope, $rootScope, ProcessErrors, CheckLicense, moment, Rest,
function(Wait, $state, $scope, $rootScope, ProcessErrors, CheckLicense, moment, Rest, $timeout,
$window, ConfigService, pendoService, insightsEnablementService, i18n, config, GetBasePath) {
const calcDaysRemaining = function(seconds) {
@ -73,7 +73,7 @@ export default
if (data.REDHAT_PASSWORD && data.REDHAT_PASSWORD !== "") {
$scope.rhCreds.password = data.REDHAT_PASSWORD;
$scope.hasPasswordFromSettings = true;
$scope.showPlaceholderPassword = true;
}
}).catch(() => {
initVars(config);
@ -117,6 +117,17 @@ export default
$window.open('https://www.ansible.com/license', '_blank');
};
$scope.replacePassword = () => {
if ($scope.user_is_superuser && !$scope.newLicense.file) {
$scope.showPlaceholderPassword = false;
$scope.rhCreds.password = "";
$timeout(() => {
$('.tooltip').remove();
$('#rh-password').focus();
});
}
};
$scope.submit = function() {
Wait('start');
$scope.licenseError = false;

View File

@ -128,17 +128,16 @@
</div>
<div>
<label class="License-label d-block" translate>PASSWORD</label>
<div class="input-group Form-mixedInputGroup" ng-if="hasPasswordFromSettings">
<span class="input-group-btn input-group-prepend">
<button aw-password-toggle id="rh_license_pass_show_input_button" class="btn btn-default show_input_button Form-passwordButton" type="button" ng-disabled="!user_is_superuser || newLicense.file" aw-tool-tip="Toggle the display of plaintext." aw-tip-placement="top">Hide</button>
<div class="input-group Form-mixedInputGroup" ng-if="showPlaceholderPassword">
<input class="form-control Form-textInput" type="text" value="ENCRYPTED" disabled />
<span class="input-group-btn input-group-append">
<button class="btn at-ButtonHollow--default at-Input-button" ng-disabled="!user_is_superuser || newLicense.file" ng-click="replacePassword()" aw-tool-tip="Replace" data-placement="top" data-original-title="Replace">
<i class="fa fa-undo"></i>
</button>
</span>
<input id="rh_license_pass" class="form-control Form-textInput" type="text" ng-model="rhCreds.password" ng-disabled="!user_is_superuser || newLicense.file" />
</div>
<div class="input-group Form-mixedInputGroup" ng-if="!hasPasswordFromSettings">
<span class="input-group-btn input-group-prepend">
<button aw-password-toggle id="rh_license_pass_show_input_button" class="btn btn-default show_input_button Form-passwordButton" type="button" ng-disabled="!user_is_superuser || newLicense.file" aw-tool-tip="Toggle the display of plaintext." aw-tip-placement="top">Show</button>
</span>
<input id="rh_license_pass" class="form-control Form-textInput" type="password" ng-model="rhCreds.password" ng-disabled="!user_is_superuser || newLicense.file" />
<div class="input-group" ng-if="!showPlaceholderPassword">
<input id="rh-password" class="form-control Form-textInput" type="password" ng-model="rhCreds.password" ng-disabled="!user_is_superuser || newLicense.file" />
</div>
</div>
</div>