mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CS-16573: cloudstack UI - create account - encode data passed to API call.
This commit is contained in:
parent
b8e87cff00
commit
cc8b97ce97
@ -180,48 +180,62 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
action: function(args) {
|
action: function(args) {
|
||||||
var array1 = [];
|
var data = {
|
||||||
array1.push("&username=" + todb(args.data.username));
|
username: args.data.username
|
||||||
var errorMsg = "";
|
};
|
||||||
|
|
||||||
var password = args.data.password;
|
var password = args.data.password;
|
||||||
if (md5Hashed)
|
if (md5Hashed) {
|
||||||
password = $.md5(password);
|
password = $.md5(password);
|
||||||
else
|
}
|
||||||
password = todb(password);
|
$.extend(data, {
|
||||||
array1.push("&password=" + password);
|
password: password
|
||||||
|
});
|
||||||
|
|
||||||
array1.push("&email=" + todb(args.data.email));
|
$.extend(data, {
|
||||||
array1.push("&firstname=" + todb(args.data.firstname));
|
email: args.data.email,
|
||||||
array1.push("&lastname=" + todb(args.data.lastname));
|
firstname: args.data.firstname,
|
||||||
|
lastname: args.data.lastname,
|
||||||
array1.push("&domainid=" + args.data.domainid);
|
domainid: args.data.domainid
|
||||||
|
});
|
||||||
|
|
||||||
var account = args.data.account;
|
var account = args.data.account;
|
||||||
if(account == null || account.length == 0)
|
if(account == null || account.length == 0) {
|
||||||
account = args.data.username;
|
account = args.data.username;
|
||||||
array1.push("&account=" + todb(account));
|
}
|
||||||
|
$.extend(data, {
|
||||||
|
account: account
|
||||||
|
});
|
||||||
|
|
||||||
var accountType = args.data.accounttype;
|
var accountType = args.data.accounttype;
|
||||||
if (args.data.accounttype == "1" && args.data.domainid != rootDomainId) //if account type is admin, but domain is not Root domain
|
if (args.data.accounttype == "1" && args.data.domainid != rootDomainId) { //if account type is admin, but domain is not Root domain
|
||||||
accountType = "2"; // Change accounttype from root-domain("1") to domain-admin("2")
|
accountType = "2"; // Change accounttype from root-domain("1") to domain-admin("2")
|
||||||
array1.push("&accounttype=" + accountType);
|
}
|
||||||
|
$.extend(data, {
|
||||||
|
accounttype: accountType
|
||||||
|
});
|
||||||
|
|
||||||
if(args.data.timezone != null && args.data.timezone.length > 0)
|
if(args.data.timezone != null && args.data.timezone.length > 0) {
|
||||||
array1.push("&timezone=" + todb(args.data.timezone));
|
$.extend(data, {
|
||||||
|
timezone: args.data.timezone
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if(args.data.networkdomain != null && args.data.networkdomain.length > 0)
|
if(args.data.networkdomain != null && args.data.networkdomain.length > 0) {
|
||||||
array1.push("&networkdomain=" + todb(args.data.networkdomain));
|
$.extend(data, {
|
||||||
|
networkdomain: args.data.networkdomain
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL("createAccount" + array1.join("")),
|
url: createURL('createAccount'),
|
||||||
dataType: "json",
|
data: data,
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
var item = json.createaccountresponse.account;
|
var item = json.createaccountresponse.account;
|
||||||
args.response.success({data:item});
|
args.response.success({data:item});
|
||||||
},
|
},
|
||||||
error: function(XMLHttpResponse) {
|
error: function(XMLHttpResponse) {
|
||||||
var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
|
args.response.error(parseXMLHttpResponse(XMLHttpResponse));
|
||||||
args.response.error(errorMsg);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user