When passwords are scrammed, report check_password_hash cannot work (#559)
This commit is contained in:
parent
72f35a6dc6
commit
4ae1b4db03
|
@ -515,12 +515,16 @@ set_password(User, Host, Password) ->
|
||||||
%% Copied some code from ejabberd_commands.erl
|
%% Copied some code from ejabberd_commands.erl
|
||||||
check_password_hash(User, Host, PasswordHash, HashMethod) ->
|
check_password_hash(User, Host, PasswordHash, HashMethod) ->
|
||||||
AccountPass = ejabberd_auth:get_password_s(User, Host),
|
AccountPass = ejabberd_auth:get_password_s(User, Host),
|
||||||
AccountPassHash = case HashMethod of
|
AccountPassHash = case {AccountPass, HashMethod} of
|
||||||
"md5" -> get_md5(AccountPass);
|
{A, _} when is_tuple(A) -> scrammed;
|
||||||
"sha" -> get_sha(AccountPass);
|
{_, "md5"} -> get_md5(AccountPass);
|
||||||
|
{_, "sha"} -> get_sha(AccountPass);
|
||||||
_ -> undefined
|
_ -> undefined
|
||||||
end,
|
end,
|
||||||
case AccountPassHash of
|
case AccountPassHash of
|
||||||
|
scrammed ->
|
||||||
|
?ERROR_MSG("Passwords are scrammed, and check_password_hash can not work.", []),
|
||||||
|
throw(passwords_scrammed_command_cannot_work);
|
||||||
undefined -> error;
|
undefined -> error;
|
||||||
PasswordHash -> ok;
|
PasswordHash -> ok;
|
||||||
_ -> error
|
_ -> error
|
||||||
|
|
Loading…
Reference in New Issue