Check if passwords match on OS Global Config page

Change-Id: Ia4d2ccb57687595e0efb13f5783f8a4ebc8819be
This commit is contained in:
jiahuay
2014-10-10 17:00:33 -07:00
parent 9da83e84da
commit 03f6c7610a
4 changed files with 32 additions and 24 deletions

View File

@@ -709,8 +709,8 @@ compassAppDev.run(function($httpBackend, settings, $http) {
var config = { var config = {
"os_config": { "os_config": {
"server_credentials": { "server_credentials": {
"username": "admin", "username": "root",
"password": "admin" "password": "huawei"
}, },
"partition": { "partition": {
"/var": { "/var": {

View File

@@ -203,11 +203,13 @@
<span class="text-danger">*</span> <span class="text-danger">*</span>
</label> </label>
<div class="col-sm-8"> <div class="col-sm-8">
<input type="password" class="col-xs-10 col-sm-5" placeholder="Confirm Password" ng-model="confirmPassword" name="server-confirmpassword" required> <input type="password" class="col-xs-10 col-sm-5" placeholder="Confirm Password" ng-model="confirmPassword" data-match="server_credentials.password" name="confirmPassword" required>
<div class="margin-left-14 inline">
<span class="text-danger" data-ng-show="generalForm.confirmPassword.$error.match">Passwords do not match</span>
</div>
</div> </div>
</div> </div>
</div> </div>
</form> </form>
<!--table class="table table-hover nowrap"> <!--table class="table table-hover nowrap">

View File

@@ -10,6 +10,7 @@ define(['uiRouter', 'angularTable', 'angularDragDrop', 'angularTouch', 'ngSpinne
'angularSpinner', 'angularSpinner',
'ngAnimate' 'ngAnimate'
]); ]);
wizardModule.config(function config($stateProvider) { wizardModule.config(function config($stateProvider) {
$stateProvider $stateProvider
.state('wizard', { .state('wizard', {
@@ -74,8 +75,6 @@ define(['uiRouter', 'angularTable', 'angularDragDrop', 'angularTouch', 'ngSpinne
} }
}); });
// get pre-config data for wizard and set wizard steps based on different adapters // get pre-config data for wizard and set wizard steps based on different adapters
var oldConfig = clusterConfigData; var oldConfig = clusterConfigData;
$scope.steps = []; $scope.steps = [];
@@ -413,7 +412,7 @@ define(['uiRouter', 'angularTable', 'angularDragDrop', 'angularTouch', 'ngSpinne
$scope.ifPreSelect = function(server) { $scope.ifPreSelect = function(server) {
server.disabled = false; server.disabled = false;
if (server.clusters) { if (server.clusters) {
if(server.clusters.length > 0) { if (server.clusters.length > 0) {
server.disabled = true; server.disabled = true;
} }
angular.forEach(server.clusters, function(svCluster) { angular.forEach(server.clusters, function(svCluster) {
@@ -611,9 +610,16 @@ define(['uiRouter', 'angularTable', 'angularDragDrop', 'angularTouch', 'ngSpinne
wizardFactory.setCommitState(commitState); wizardFactory.setCommitState(commitState);
}); });
} else { } else {
var message = { var message = {};
if ($scope.generalForm.$error.required) {
message = {
"message": "The required(*) fields can not be empty !" "message": "The required(*) fields can not be empty !"
}; };
} else if ($scope.generalForm.$error.match) {
message = {
"message": "The passwords do not match"
};
}
var commitState = { var commitState = {
"name": "os_global", "name": "os_global",
"state": "error", "state": "error",
@@ -880,7 +886,7 @@ define(['uiRouter', 'angularTable', 'angularDragDrop', 'angularTouch', 'ngSpinne
var ip_start = $("#" + key + "-ipstart").val(); var ip_start = $("#" + key + "-ipstart").val();
var interval = parseInt($("#" + key + "-increase-num").val()); var interval = parseInt($("#" + key + "-increase-num").val());
$scope.fillIPBySequence(ip_start, interval, key); $scope.fillIPBySequence(ip_start, interval, key);
}) });
// Autofill hostname // Autofill hostname
var hostname_rule = $("#hostname-rule").val(); var hostname_rule = $("#hostname-rule").val();
$scope.fillHostname(hostname_rule); $scope.fillHostname(hostname_rule);
@@ -924,15 +930,15 @@ define(['uiRouter', 'angularTable', 'angularDragDrop', 'angularTouch', 'ngSpinne
angular.forEach($scope.servers, function(server) { angular.forEach($scope.servers, function(server) {
if (ipParts[3] > 255) { if (ipParts[3] > 255) {
ipParts[3] = ipParts[3] - 256; ipParts[3] = ipParts[3] - 256;
ipParts[2]++; ipParts[2] ++;
} }
if (ipParts[2] > 255) { if (ipParts[2] > 255) {
ipParts[2] = ipParts[2] - 256; ipParts[2] = ipParts[2] - 256;
ipParts[1]++; ipParts[1] ++;
} }
if (ipParts[1] > 255) { if (ipParts[1] > 255) {
ipParts[1] = ipParts[1] - 256; ipParts[1] = ipParts[1] - 256;
ipParts[0]++; ipParts[0] ++;
} }
if (ipParts[0] > 255) { if (ipParts[0] > 255) {
server.networks[interface].ip = ""; server.networks[interface].ip = "";
@@ -1243,7 +1249,7 @@ define(['uiRouter', 'angularTable', 'angularDragDrop', 'angularTouch', 'ngSpinne
} }
} }
}; };
if($scope.currentAdapterName == "ceph_openstack_icehouse") { if ($scope.currentAdapterName == "ceph_openstack_icehouse") {
targetSysConfigData["package_config"]["ceph_config"] = $scope.cephConfig; targetSysConfigData["package_config"]["ceph_config"] = $scope.cephConfig;
} }
dataService.updateClusterConfig(cluster.id, targetSysConfigData).success(function(data) { dataService.updateClusterConfig(cluster.id, targetSysConfigData).success(function(data) {
@@ -1726,7 +1732,7 @@ define(['uiRouter', 'angularTable', 'angularDragDrop', 'angularTouch', 'ngSpinne
}); });
}).error(function(data) { }).error(function(data) {
console.warn("Review hosts error: ", data); console.warn("Review hosts error: ", data);
}) });
//TODO: error handling //TODO: error handling
}; };