OSDN Git Service

新しいパスワードを入力しないと更新できないようにした
[webchat/WebChat.git] / profile.js
index 5c10efc..c0b190e 100644 (file)
@@ -201,10 +201,7 @@ function edit_postproc(req, res)
                }\r
                async.waterfall([\r
                        function(cb){\r
-                               if(typeof(req.body.updatepassword) == "undefined")\r
-                                       collection.UpdatAsync(req.body.name,req.body,null,cb);\r
-                               else\r
-                                       collection.UpdatAsync(req.body.name,req.body,req.body.password,cb);\r
+                               collection.UpdatAsync(req.body.name,req.body,cb);\r
                        },\r
                ],function(err,result){\r
                        if(err != null)\r
@@ -292,8 +289,8 @@ function ProfileCollection()
                var item = GetItem(data);;\r
                pool.query("INSERT INTO profilelist SET ?",[item],cb);\r
        }\r
-       this.UpdatAsync = function(name,data,newpassword,cb){\r
-               var item = GetItem(data,newpassword);\r
+       this.UpdatAsync = function(name,data,cb){\r
+               var item = GetItem(data);\r
                pool.query("UPDATE profilelist SET ? WHERE name = ?",[item,name],cb);\r
        }\r
        this.ClearAsync = function(cb){\r
@@ -328,23 +325,17 @@ function ProfileCollection()
                };\r
                for(var key in config.alias)\r
                {\r
+                       if(typeof(config.alias[key].nodefinetable) != "undefined" && \r
+                               config.alias[key].nodefinetable)\r
+                               continue;\r
                        if(config.alias[key].visible_edit)\r
                        {\r
                                if(config.alias[key].type == "password")\r
-                               {\r
-                                       if(typeof(newpw) != "undefined")\r
-                                               data[key] = newpw;\r
-                                       if(data[key] != null)\r
-                                               item[key] = md5_hex(data[key]);\r
-                               }\r
+                                       item[key] = md5_hex(data[key]);\r
                                else if(data[key] == "" && typeof(config.alias[key].defaultvalue) != "undefined")\r
-                               {\r
                                        item[key] = config.alias[key].defaultvalue;\r
-                               }\r
                                else\r
-                               {\r
                                        item[key] = data[key];\r
-                               }\r
                        }\r
                }\r
                return item;\r
@@ -373,10 +364,17 @@ function Validator()
                        if(typeof(alias[key].isnotempty) != "undefined" &&\r
                                alias[key].isnotempty && body[key] == "")\r
                                        message = resource.is_not_empty;\r
-                       message = IsValidate(body[key],alias[key].type,alias[key].rule);\r
+                       else if(typeof(alias[key].mustmatchitem) != "undefined" &&\r
+                               body[key] != body[alias[key].mustmatchitem])\r
+                                       message = util.format(resource.must_match_item,alias[alias[key].mustmatchitem].name); \r
+                       else\r
+                               message = IsValidate(body[key],alias[key].type,alias[key].rule);\r
                        if(message != null)\r
                        {\r
-                               this.Message += "<p>" + alias[key].name + ":" + message + "</p>\n";\r
+                               if(alias[key].name == "")\r
+                                       this.Message += "<p>" + message + "</p>\n";\r
+                               else\r
+                                       this.Message += "<p>" + alias[key].name + ":" + message + "</p>\n";\r
                                result = true;\r
                        }\r
                }\r