|
|
|
@ -67,9 +67,8 @@ public class User_p {
|
|
|
|
|
plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
|
|
|
|
|
userDB.Entry entry=null;
|
|
|
|
|
|
|
|
|
|
if( (post == null) || (!post.containsKey("change")) ){
|
|
|
|
|
prop.put("page", 0);
|
|
|
|
|
//default values
|
|
|
|
|
prop.put("page", 0);
|
|
|
|
|
prop.put("page_current_user", "newuser");
|
|
|
|
|
prop.put("page_username", "");
|
|
|
|
|
prop.put("page_firstname", "");
|
|
|
|
@ -92,7 +91,15 @@ public class User_p {
|
|
|
|
|
}
|
|
|
|
|
prop.put("page_users", numUsers);
|
|
|
|
|
|
|
|
|
|
if(post != null && post.containsKey("user") && !((String)post.get("user")).equals("newuser")){
|
|
|
|
|
if(post == null){
|
|
|
|
|
return prop;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//user != current_user
|
|
|
|
|
//user=from userlist
|
|
|
|
|
//current_user = edited user
|
|
|
|
|
if(post.containsKey("user") && !((String)post.get("user")).equals("newuser")){
|
|
|
|
|
//defaults for newuser are set above
|
|
|
|
|
entry=sb.userDB.getEntry((String)post.get("user"));
|
|
|
|
|
//TODO: set username read-only in html
|
|
|
|
|
prop.put("page_current_user", post.get("user"));
|
|
|
|
@ -102,10 +109,7 @@ public class User_p {
|
|
|
|
|
prop.put("page_address", entry.getAddress());
|
|
|
|
|
prop.put("page_timelimit", entry.getTimeLimit());
|
|
|
|
|
prop.put("page_timeused", entry.getTimeUsed());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { //Data submitted
|
|
|
|
|
} else if(post.containsKey("change")) { //Data submitted
|
|
|
|
|
prop.put("page", 1); //results
|
|
|
|
|
prop.put("page_text", 0);
|
|
|
|
|
prop.put("page_error", 0);
|
|
|
|
@ -120,7 +124,7 @@ public class User_p {
|
|
|
|
|
String timeLimit="0";
|
|
|
|
|
String timeUsed="0";
|
|
|
|
|
HashMap mem=new HashMap();
|
|
|
|
|
if( post != null && post.containsKey("current_user") && post.get("current_user").equals("newuser")){
|
|
|
|
|
if( post.get("current_user").equals("newuser")){ //new user
|
|
|
|
|
username=(String)post.get("username");
|
|
|
|
|
pw=(String)post.get("password");
|
|
|
|
|
pw2=(String)post.get("password2");
|
|
|
|
@ -144,7 +148,7 @@ public class User_p {
|
|
|
|
|
entry=sb.userDB.createEntry(username, mem);
|
|
|
|
|
sb.userDB.addEntry(entry);
|
|
|
|
|
|
|
|
|
|
}else if(post != null && post.containsKey("currentuser")){
|
|
|
|
|
} else { //edit user
|
|
|
|
|
username=(String)post.get("username");
|
|
|
|
|
pw=(String)post.get("password");
|
|
|
|
|
pw2=(String)post.get("password2");
|
|
|
|
@ -158,7 +162,8 @@ public class User_p {
|
|
|
|
|
timeLimit=(String)post.get("timelimit");
|
|
|
|
|
timeUsed=(String)post.get("timelimit");
|
|
|
|
|
|
|
|
|
|
entry = sb.userDB.getEntry("username");
|
|
|
|
|
entry = sb.userDB.getEntry(username);
|
|
|
|
|
if(entry != null){
|
|
|
|
|
try{
|
|
|
|
|
entry.setProperty(userDB.Entry.MD5ENCODED_USERPWD_STRING, serverCodings.encodeMD5Hex(username+":"+pw));
|
|
|
|
|
entry.setProperty(userDB.Entry.USER_FIRSTNAME, firstName);
|
|
|
|
@ -168,8 +173,8 @@ public class User_p {
|
|
|
|
|
entry.setProperty(userDB.Entry.TIME_USED, timeUsed);
|
|
|
|
|
}catch (IOException e){
|
|
|
|
|
}
|
|
|
|
|
}//TODO? else error
|
|
|
|
|
|
|
|
|
|
sb.userDB.addEntry(entry);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|