* 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 (EJAB-116).
* src/jlib.erl: String to JID conversion now returns an error if
the JID string contains two arobases.

SVN Revision: 588
This commit is contained in:
Mickaël Rémond 2006-07-07 08:06:12 +00:00
parent 6225c951fd
commit 6290bac932
3 changed files with 22 additions and 7 deletions

View File

@ -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> 2006-07-06 Mickael Remond <mickael.remond@process-one.net>
* src/mod_shared_roster.erl: Shared roster entries can now be moved or * src/mod_shared_roster.erl: Shared roster entries can now be moved or

View File

@ -181,6 +181,9 @@ string_to_jid1([], "") ->
string_to_jid1([], N) -> string_to_jid1([], N) ->
make_jid("", lists:reverse(N), ""). make_jid("", lists:reverse(N), "").
%% Only one "@" is admitted per JID
string_to_jid2([$@ | _J], _N, _S) ->
error;
string_to_jid2([$/ | _J], _N, "") -> string_to_jid2([$/ | _J], _N, "") ->
error; error;
string_to_jid2([$/ | J], N, S) -> string_to_jid2([$/ | J], N, S) ->

View File

@ -1229,7 +1229,7 @@ list_vhosts(Lang) ->
list_users(Host, Query, Lang, URLFunc) -> 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), Users = ejabberd_auth:get_vh_registered_users(Host),
SUsers = lists:sort([{S, U} || {U, S} <- Users]), SUsers = lists:sort([{S, U} || {U, S} <- Users]),
FUsers = FUsers =
@ -1262,28 +1262,32 @@ list_users(Host, Query, Lang, URLFunc) ->
[?XE("table", [?XE("table",
[?XE("tr", [?XE("tr",
[?XC("td", ?T("User") ++ ":"), [?XC("td", ?T("User") ++ ":"),
?XE("td", [?INPUT("text", "newusername", "")]) ?XE("td", [?INPUT("text", "newusername", "")]),
?XE("td", [?C([" @ ", Host])])
]), ]),
?XE("tr", ?XE("tr",
[?XC("td", ?T("Password") ++ ":"), [?XC("td", ?T("Password") ++ ":"),
?XE("td", [?INPUT("password", "newuserpassword", "")]) ?XE("td", [?INPUT("password", "newuserpassword", "")]),
?X("td")
]), ]),
?XE("tr", ?XE("tr",
[?X("td"), [?X("td"),
?XAE("td", [{"class", "alignright"}], ?XAE("td", [{"class", "alignright"}],
[?INPUTT("submit", "addnewuser", "Add User")]) [?INPUTT("submit", "addnewuser", "Add User")]),
?X("td")
])]), ])]),
?P] ++ ?P] ++
FUsers)]. 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 case lists:keysearch("addnewuser", 1, Query) of
{value, _} -> {value, _} ->
{value, {_, JIDString}} = {value, {_, Username}} =
lists:keysearch("newusername", 1, Query), lists:keysearch("newusername", 1, Query),
{value, {_, Password}} = {value, {_, Password}} =
lists:keysearch("newuserpassword", 1, Query), lists:keysearch("newuserpassword", 1, Query),
case jlib:string_to_jid(JIDString) of case jlib:string_to_jid(Username++"@"++Host) of
error -> error ->
error; error;
#jid{user = User, server = Server} -> #jid{user = User, server = Server} ->