Change proposed to update module to last ejabberd_auth API (#228, #230)

This commit is contained in:
Badlop 2018-01-03 17:22:49 +01:00
parent 6a4b9a08d5
commit 156331c123
1 changed files with 6 additions and 22 deletions

View File

@ -58,9 +58,9 @@ start(Host) ->
plain_password_required(Server) ->
store_type(Server) == scram.
-spec store_type(binary()) -> plain | scram.
store_type(Server) ->
ejabberd_auth:password_format(Server).
-spec store_type(binary()) -> external.
store_type(_) ->
external.
-spec check_password(ejabberd:luser(), binary(), ejabberd:lserver(), binary()) -> boolean().
check_password(LUser, _AuthzId, LServer, Password) ->
@ -133,25 +133,9 @@ try_register(LUser, LServer, Password) ->
Error -> Error
end.
-spec get_password(ejabberd:luser(), ejabberd:lserver()) -> false | binary() |
{binary(), binary(), binary(), integer()}.
get_password(LUser, LServer) ->
case make_req(get, <<"get_password">>, LUser, LServer, <<"">>) of
{error, _} ->
false;
{ok, Password} ->
case scram2:enabled(LServer) of
true ->
case scram2:deserialize(Password) of
{ok, #scram{} = Scram} ->
scram2:scram_to_tuple(Scram);
_ ->
false
end;
false ->
Password
end
end.
-spec get_password(ejabberd:luser(), ejabberd:lserver()) -> error.
get_password(_, _) ->
error.
-spec get_password_s(ejabberd:luser(), ejabberd:lserver()) -> binary().
get_password_s(User, Server) ->