From 0dbab772a68c6d287c7881e3347d436865af2a9c Mon Sep 17 00:00:00 2001 From: stefanp Date: Tue, 26 Mar 2002 19:00:03 +0000 Subject: [PATCH] saving of username and password now works through appending and not by saving the whole properties list. --- Global/functions.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Global/functions.js b/Global/functions.js index 348c1eb7..97d90318 100644 --- a/Global/functions.js +++ b/Global/functions.js @@ -204,10 +204,15 @@ function createAuth() { renderSkin("pwdform",obj); return false; } - var props = root.getProperties(); - props.put("adminUsername", Packages.helma.util.MD5Encoder.encode(req.data.username) ); - props.put("adminPassword", Packages.helma.util.MD5Encoder.encode(req.data.password) ); - props.store( new java.io.FileOutputStream( new java.io.File(root.getHopHome(),"server.properties") ), "# properties saved from application 'manage'" ); + var f = new File(root.getHopHome().toString, "server.properties"); + var str = f.readAll(); + var sep = java.lang.System.getProperty("line.separator"); + str += sep + "adminUsername=" + Packages.helma.util.MD5Encoder.encode(req.data.username) + sep; + str += "adminPassword=" + Packages.helma.util.MD5Encoder.encode(req.data.password) + sep; + f.remove(); + f.open(); + f.write(str); + f.close(); app.__app__.logEvent( req.data.http_remotehost + " saved new adminUsername/adminPassword to server.properties"); res.redirect ( root.href("main") );