]> granicus.if.org Git - ejabberd/commitdiff
* src/web/ejabberd_web_admin.erl: User creation form now creates
authorMickaël Rémond <mickael.remond@process-one.net>
Fri, 7 Jul 2006 08:06:12 +0000 (08:06 +0000)
committerMickaël Rémond <mickael.remond@process-one.net>
Fri, 7 Jul 2006 08:06:12 +0000 (08:06 +0000)
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

ChangeLog
src/jlib.erl
src/web/ejabberd_web_admin.erl

index c76e6719149cdca466123e9b51add5fce09eb88c..8bf619f654ef98aa6663d148c75e7807944673ae 100644 (file)
--- 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
index 5de126ee8f40e16235aaa27f3a67093f1928e14a..74369cf22a91f938a8580c3ef3f98fbb6ef38b48 100644 (file)
@@ -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) ->
index d75102e435449fdd2f203db18a65686c9f7d0e62..1c03e50e1ca7b226ff00251301f74879f2653912 100644 (file)
@@ -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} ->