saving of username and password now works through appending and not by saving the whole properties list.

This commit is contained in:
stefanp 2002-03-26 19:00:03 +00:00
parent 660ea666d9
commit 0dbab772a6

View file

@ -204,10 +204,15 @@ function createAuth() {
renderSkin("pwdform",obj); renderSkin("pwdform",obj);
return false; return false;
} }
var props = root.getProperties(); var f = new File(root.getHopHome().toString, "server.properties");
props.put("adminUsername", Packages.helma.util.MD5Encoder.encode(req.data.username) ); var str = f.readAll();
props.put("adminPassword", Packages.helma.util.MD5Encoder.encode(req.data.password) ); var sep = java.lang.System.getProperty("line.separator");
props.store( new java.io.FileOutputStream( new java.io.File(root.getHopHome(),"server.properties") ), "# properties saved from application 'manage'" ); 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"); app.__app__.logEvent( req.data.http_remotehost + " saved new adminUsername/adminPassword to server.properties");
res.redirect ( root.href("main") ); res.redirect ( root.href("main") );