Updated Branches:
  refs/heads/master bfbf634c0 -> 8692f6860

CS-16573: cloudstack UI - create user - encode data passed to API call.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/8692f686
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/8692f686
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/8692f686

Branch: refs/heads/master
Commit: 8692f68603dd45d6f1c2a470db94365dfd5262d7
Parents: bfbf634
Author: Jessica Wang <[email protected]>
Authored: Tue Oct 30 15:13:44 2012 -0700
Committer: Jessica Wang <[email protected]>
Committed: Wed Oct 31 15:18:46 2012 -0700

----------------------------------------------------------------------
 ui/scripts/accounts.js |   52 +++++++++++++++++++++++++-----------------
 1 files changed, 31 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8692f686/ui/scripts/accounts.js
----------------------------------------------------------------------
diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js
index 0ba3e3f..9075462 100644
--- a/ui/scripts/accounts.js
+++ b/ui/scripts/accounts.js
@@ -888,29 +888,39 @@
               action: function(args) {
                 var accountObj = args.context.accounts[0];
 
-                var array1 = [];
-                array1.push("&username=" + todb(args.data.username));
-
+                var data = {
+                                                                 username: 
args.data.username                                                              
    
+                                                               };
+                                                               
                 var password = args.data.password;
-                if (md5Hashed)
-                  password = $.md5(password);
-                else
-                  password = todb(password);
-                array1.push("&password=" + password);
-
-                array1.push("&email=" + todb(args.data.email));
-                array1.push("&firstname=" + todb(args.data.firstname));
-                array1.push("&lastname=" + todb(args.data.lastname));
-                if(args.data.timezone != null && args.data.timezone.length > 0)
-                  array1.push("&timezone=" + todb(args.data.timezone));
-
-                array1.push("&domainid=" + accountObj.domainid);
-                array1.push("&account=" + todb(accountObj.name));
-                array1.push("&accounttype=" + accountObj.accounttype);
-
+                if (md5Hashed) {
+                  password = $.md5(password);     
+                }                                                              
        
+                                                               $.extend(data, {
+                  password: password
+                });                    
+               
+                                                               $.extend(data, {
+                                                                 email: 
args.data.email,
+                                                                       
firstname: args.data.firstname,
+                                                                       
lastname: args.data.lastname
+                                                               });
+                                                               
+                if(args.data.timezone != null && args.data.timezone.length > 
0) {
+                                                                 
$.extend(data, {
+                                                                         
timezone: args.data.timezone
+                                                                       });     
                                                        
+                                                               }
+               
+                                                               $.extend(data, {
+                                                                 domainid: 
accountObj.domainid,
+                  account: accountObj.name,
+                                                                       
accounttype: accountObj.accounttype
+                                                               });
+                                                               
                 $.ajax({
-                  url: createURL("createUser" + array1.join("")),
-                  dataType: "json",
+                  url: createURL('createUser'),
+                  data: data,
                   success: function(json) {
                     var item = json.createuserresponse.user;
                     args.response.success({data: item});

Reply via email to