mod_register:send_registration_notifications(Mod, UJID, Source) calls ejabberd_auth_sql:is_user_exists()

Hello, I have no idea why mod_register:send_registration_notifications(Mod, UJID, Source) calls ejabberd_auth_sql:is_user_exists() again after registration is done and send notification to the watch dogs.

I cannot reproduce. I add

I cannot reproduce.

I add debug lines in ejabberd_auth_sql.erl, so I see in logs when those functions are called. Then I start ejabberd in live mode, so I get an Erlang shell, and login an admin user. Then I execute this call:

mod_register:send_registration_notifications(mod_register,
 {jid,<<"user34">>,<<"localhost">>,<<>>,<<"user34">>,<<"localhost">>,<<>>},
 {127,0,0,1}).

I see no activity in ejabberd_auth_sql module

Let me show you my code in

Let me show you my code in ejabberd_auth_sql.erl :

-----------------------------------------------------------------------------------------------------
%% @spec (User, Server) -> true | false | {error, Error}
is_user_exists(User, Server) ->
    LServer = jid:nameprep(Server),
    LUser = jid:nodeprep(User),
    if (LUser == error) or (LServer == error) ->
            false;
       (LUser == <<>>) or (LServer == <<>>) ->
            false;
       true ->
       ?INFO_MSG("* * * EJABBERD_AUTH_SQL:IS_USER_EXISTS * * * | USER : ~p", [LUser]),
	  try sql_queries:get_password(LServer, LUser) of
	    {selected, [{_Password}]} ->
        ?INFO_MSG("* * * EJABBERD_AUTH_SQL:IS_USER_EXISTS | RESULSET : ~p",[_Password]),
		true; %% Account exists
	    {selected, []} ->
        ?INFO_MSG("* * * EJABBERD_AUTH_SQL:IS_USER_EXISTS | ACCOUNT DOES NOT EXIST", []),
		false; %% Account does not exist
	    {error, Error} -> {error, Error}
	  catch
	    _:B -> {error, B}
	  end
    end.
--------------------------------------------------------------------------------------------------------------------------------

After ran mod_register:send_registration_notifications() in the debug shell here is what is shown in the shell

09:06:53.821 [info] * * * EJABBERD_AUTH_SQL:IS_USER_EXISTS * * * | USER : <<"dev23">>
09:06:53.861 [info] * * * EJABBERD_AUTH_SQL:IS_USER_EXISTS | RESULSET : <<"qWOm6JSdMxCgRgaF+Q2r3yGrTFI=">>
---------------------------------------------------------------------------------------------------------------------------------

And the message is sent to dev23.
Note : i am using ejabberd-17.04.41

Syndicate content