aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--src/jlib.erl3
-rw-r--r--src/web/ejabberd_web_admin.erl18
3 files changed, 22 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index c76e67191..8bf619f65 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-07-07 Mickael Remond <mickael.remond@process-one.net>
+
+ * src/web/ejabberd_web_admin.erl: User creation form now creates the
+ user for the current virual host only and does not require to type
+ the hostname.
+ * src/jlib.erl: String to JID conversion now returns an error if the
+ JID string contains two arobases.
+
2006-07-06 Mickael Remond <mickael.remond@process-one.net>
* src/mod_shared_roster.erl: Shared roster entries can now be moved or
diff --git a/src/jlib.erl b/src/jlib.erl
index 5de126ee8..74369cf22 100644
--- a/src/jlib.erl
+++ b/src/jlib.erl
@@ -181,6 +181,9 @@ string_to_jid1([], "") ->
string_to_jid1([], N) ->
make_jid("", lists:reverse(N), "").
+%% Only one "@" is admitted per JID
+string_to_jid2([$@ | _J], _N, _S) ->
+ error;
string_to_jid2([$/ | _J], _N, "") ->
error;
string_to_jid2([$/ | J], N, S) ->
diff --git a/src/web/ejabberd_web_admin.erl b/src/web/ejabberd_web_admin.erl
index d75102e43..1c03e50e1 100644
--- a/src/web/ejabberd_web_admin.erl
+++ b/src/web/ejabberd_web_admin.erl
@@ -1229,7 +1229,7 @@ list_vhosts(Lang) ->
list_users(Host, Query, Lang, URLFunc) ->
- Res = list_users_parse_query(Query),
+ Res = list_users_parse_query(Query, Host),
Users = ejabberd_auth:get_vh_registered_users(Host),
SUsers = lists:sort([{S, U} || {U, S} <- Users]),
FUsers =
@@ -1262,28 +1262,32 @@ list_users(Host, Query, Lang, URLFunc) ->
[?XE("table",
[?XE("tr",
[?XC("td", ?T("User") ++ ":"),
- ?XE("td", [?INPUT("text", "newusername", "")])
+ ?XE("td", [?INPUT("text", "newusername", "")]),
+ ?XE("td", [?C([" @ ", Host])])
]),
?XE("tr",
[?XC("td", ?T("Password") ++ ":"),
- ?XE("td", [?INPUT("password", "newuserpassword", "")])
+ ?XE("td", [?INPUT("password", "newuserpassword", "")]),
+ ?X("td")
]),
?XE("tr",
[?X("td"),
?XAE("td", [{"class", "alignright"}],
- [?INPUTT("submit", "addnewuser", "Add User")])
+ [?INPUTT("submit", "addnewuser", "Add User")]),
+ ?X("td")
])]),
?P] ++
FUsers)].
-list_users_parse_query(Query) ->
+%% Parse user creation query and try register:
+list_users_parse_query(Query, Host) ->
case lists:keysearch("addnewuser", 1, Query) of
{value, _} ->
- {value, {_, JIDString}} =
+ {value, {_, Username}} =
lists:keysearch("newusername", 1, Query),
{value, {_, Password}} =
lists:keysearch("newuserpassword", 1, Query),
- case jlib:string_to_jid(JIDString) of
+ case jlib:string_to_jid(Username++"@"++Host) of
error ->
error;
#jid{user = User, server = Server} ->