diff --git a/htroot/User_p.html b/htroot/User_p.html index a424c3d71..50aa1f7cf 100644 --- a/htroot/User_p.html +++ b/htroot/User_p.html @@ -97,6 +97,8 @@ User changed: #[username]# generic error. :: Passwords do not match. +:: +Username too short. Username must be >= 4 Charakters. #(/error)#

If you want to manage more Users, return to the user page. diff --git a/htroot/User_p.java b/htroot/User_p.java index 64377b382..0074a697e 100644 --- a/htroot/User_p.java +++ b/htroot/User_p.java @@ -150,10 +150,15 @@ public class User_p { mem.put(userDB.Entry.DOWNLOAD_RIGHT, downloadRight); mem.put(userDB.Entry.BLOG_RIGHT, blogRight); - entry=sb.userDB.createEntry(username, mem); - sb.userDB.addEntry(entry); - prop.put("page_text_username", username); - prop.put("page_text", 1); + try{ + entry=sb.userDB.createEntry(username, mem); + sb.userDB.addEntry(entry); + prop.put("page_text_username", username); + prop.put("page_text", 1); + }catch(IllegalArgumentException e){ + prop.put("page_error", 3); + } + } else { //edit user diff --git a/source/de/anomic/data/userDB.java b/source/de/anomic/data/userDB.java index a155af52c..6328a80cb 100644 --- a/source/de/anomic/data/userDB.java +++ b/source/de/anomic/data/userDB.java @@ -127,7 +127,7 @@ public final class userDB { } } - public Entry createEntry(String userName, HashMap userProps) { + public Entry createEntry(String userName, HashMap userProps) throws IllegalArgumentException{ Entry entry = new Entry(userName,userProps); return entry; } @@ -329,7 +329,7 @@ public final class userDB { private String userName; private Calendar oldDate, newDate; - public Entry(String userName, Map mem) { + public Entry(String userName, Map mem) throws IllegalArgumentException { if ((userName == null) || (userName.length() == 0)) throw new IllegalArgumentException("Username needed."); if(userName.length()>128){