ejabberd - Comments for "Check user is registered or not in ejabberd Server.." https://www.ejabberd.im/node/3606 en Automated way using mod_xmlrpc or ejabberd_ctl patch https://www.ejabberd.im/node/3606#comment-54540 <p>If you want an automated way to check this using XML-RPC calls, you can install mod_xmlrpc in ejabberd. It provides calls for that.</p> <p>If you want an automated way to check this using the system shell, you can apply this patch to ejabberd 2.0.5:</p> <pre> --- a/src/ejabberd_ctl.erl +++ b/src/ejabberd_ctl.erl @@ -123,6 +123,38 @@ process(["register", User, Server, Password]) -&gt; ?STATUS_ERROR end; +process(["is_registered", User, Server]) -&gt; + case ejabberd_auth:is_user_exists(User, Server) of + true -&gt; + ?PRINT("User ~p already registered at node ~p~n", + [User ++ "@" ++ Server, node()]), + ?STATUS_SUCCESS; + false -&gt; + ?PRINT("User ~p not registered at node ~p~n", + [User ++ "@" ++ Server, node()]), + ?STATUS_ERROR; + {error, Reason} -&gt; + ?PRINT("Can't register user ~p at node ~p: ~p~n", + [User ++ "@" ++ Server, node(), Reason]), + ?STATUS_ERROR + end; + +process(["check_password", User, Server, Password]) -&gt; + case ejabberd_auth:check_password(User, Server, Password) of + true -&gt; + ?PRINT("Password of user ~p is good~n", + [User ++ "@" ++ Server]), + ?STATUS_SUCCESS; + false -&gt; + ?PRINT("Password of user ~p is bad~n", + [User ++ "@" ++ Server]), + ?STATUS_ERROR; + {error, Reason} -&gt; + ?PRINT("Can't register user ~p at node ~p: ~p~n", + [User ++ "@" ++ Server, node(), Reason]), + ?STATUS_ERROR + end; + process(["unregister", User, Server]) -&gt; case ejabberd_auth:remove_user(User, Server) of {error, Reason} -&gt; </pre><p>And then you can get that information with:</p> <pre> $ sudo ejabberdctl is_registered badlop localhost User "badlop@localhost" already registered at node ejabberd@localhost $ echo $? 0 $ sudo ejabberdctl is_registered badlop2 localhost User "badlop2@localhost" not registered at node ejabberd@localhost $ echo $? 1 $ sudo ejabberdctl check_password badlop localhost paspass Password of user "badlop@localhost" is good $ sudo ejabberdctl check_password badlop localhost gugubadpass Password of user "badlop@localhost" is bad </pre><p>In ejabberd 2.1.0 and higher those modules will be replaced with ejabberd_xmlrpc, mod_admin_extra. Also mod_rest can be used to support HTTP POST calls.</p> Thu, 13 Aug 2009 18:26:00 +0000 mfoss comment 54540 at https://www.ejabberd.im You can easily know which https://www.ejabberd.im/node/3606#comment-54537 <p>You can easily know which user is registered by using the web admin interface. Also, you can access this information while your are logged in on your jabber server with your administrator account, by browsing the services of your server and chosing the one that allows you to check all the registered users.</p> Wed, 12 Aug 2009 07:21:59 +0000 Gemini comment 54537 at https://www.ejabberd.im