mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Return Registered element when account exists (thanks to PioneerMike)
This commit is contained in:
parent
0d065dd021
commit
11130806f9
@ -180,13 +180,28 @@ process_iq(From, To,
|
|||||||
exmpp_iq:error(IQ_Rec, 'bad-request')
|
exmpp_iq:error(IQ_Rec, 'bad-request')
|
||||||
end;
|
end;
|
||||||
get ->
|
get ->
|
||||||
|
{UsernameSubels, QuerySubels} =
|
||||||
|
case {exmpp_jid:node_as_list(From), exmpp_jid:prep_domain_as_list(From)} of
|
||||||
|
{User, Server} when is_list(User) and is_list(Server) ->
|
||||||
|
case ejabberd_auth:is_user_exists(User,Server) of
|
||||||
|
true ->
|
||||||
|
{[#xmlcdata{cdata = list_to_binary(User)}],
|
||||||
|
[#xmlel{ns = ?NS_INBAND_REGISTER, name = 'registered'}]};
|
||||||
|
false ->
|
||||||
|
{[#xmlcdata{cdata = list_to_binary(User)}], []}
|
||||||
|
end;
|
||||||
|
_ ->
|
||||||
|
{[], []}
|
||||||
|
end,
|
||||||
Result = #xmlel{ns = ?NS_INBAND_REGISTER, name = 'query', children =
|
Result = #xmlel{ns = ?NS_INBAND_REGISTER, name = 'query', children =
|
||||||
[#xmlel{ns = ?NS_INBAND_REGISTER, name = 'instructions', children =
|
[#xmlel{ns = ?NS_INBAND_REGISTER, name = 'instructions', children =
|
||||||
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang,
|
[#xmlcdata{cdata = list_to_binary(
|
||||||
|
translate:translate(Lang,
|
||||||
"Choose a username and password "
|
"Choose a username and password "
|
||||||
"to register with this server"))}]},
|
"to register with this server"))}]},
|
||||||
#xmlel{ns = ?NS_INBAND_REGISTER, name = 'username'},
|
#xmlel{ns = ?NS_INBAND_REGISTER, name = 'username', children = UsernameSubels},
|
||||||
#xmlel{ns = ?NS_INBAND_REGISTER, name = 'password'}]},
|
#xmlel{ns = ?NS_INBAND_REGISTER, name = 'password'}
|
||||||
|
| QuerySubels]},
|
||||||
exmpp_iq:result(IQ_Rec, Result)
|
exmpp_iq:result(IQ_Rec, Result)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user