mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUAC-1176: Ensure login fields default to blank, not null or undefined.
This commit is contained in:
@@ -109,10 +109,13 @@ angular.module('login').directive('guacLogin', [function guacLogin() {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Ensure provided values are included within entered values, even if
|
||||||
|
// they have no corresponding input fields
|
||||||
$scope.$watch('values', function resetEnteredValues(values) {
|
$scope.$watch('values', function resetEnteredValues(values) {
|
||||||
angular.extend($scope.enteredValues, values || {});
|
angular.extend($scope.enteredValues, values || {});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Update field information when form is changed
|
||||||
$scope.$watch('form', function resetRemainingFields(fields) {
|
$scope.$watch('form', function resetRemainingFields(fields) {
|
||||||
|
|
||||||
// If no fields are provided, then no fields remain
|
// If no fields are provided, then no fields remain
|
||||||
@@ -126,6 +129,12 @@ angular.module('login').directive('guacLogin', [function guacLogin() {
|
|||||||
return !(field.name in $scope.values);
|
return !(field.name in $scope.values);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Set default values for all unset fields
|
||||||
|
angular.forEach($scope.remainingFields, function setDefault(field) {
|
||||||
|
if (!$scope.enteredValues[field.name])
|
||||||
|
$scope.enteredValues[field.name] = '';
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user