fix(authn): fix superuser when missing is_superuser_field

This commit is contained in:
zhouzb 2021-12-01 09:23:36 +08:00
parent 616b630781
commit 6b8997cbda
1 changed files with 3 additions and 1 deletions

View File

@ -237,7 +237,9 @@ check_password(Password,
is_superuser(Doc, #{is_superuser_field := IsSuperuserField}) -> is_superuser(Doc, #{is_superuser_field := IsSuperuserField}) ->
IsSuperuser = maps:get(IsSuperuserField, Doc, false), IsSuperuser = maps:get(IsSuperuserField, Doc, false),
emqx_authn_utils:is_superuser(#{<<"is_superuser">> => IsSuperuser}). emqx_authn_utils:is_superuser(#{<<"is_superuser">> => IsSuperuser});
is_superuser(_, _) ->
emqx_authn_utils:is_superuser(#{<<"is_superuser">> => false}).
hash(Algorithm, Password, Salt, prefix) -> hash(Algorithm, Password, Salt, prefix) ->
emqx_passwd:hash(Algorithm, <<Salt/binary, Password/binary>>); emqx_passwd:hash(Algorithm, <<Salt/binary, Password/binary>>);