fix(authn): fix handling of pgsql response

This commit is contained in:
zhouzb 2021-10-21 17:41:16 +08:00 committed by x1001100011
parent cc5b995cf2
commit ddcf73f465
1 changed files with 2 additions and 1 deletions

View File

@ -108,7 +108,8 @@ authenticate(#{password := Password} = Credential,
{ok, _Columns, []} -> ignore;
{ok, Columns, Rows} ->
NColumns = [Name || #column{name = Name} <- Columns],
Selected = maps:from_list(lists:zip(NColumns, Rows)),
NRows = [erlang:element(1, Row) || Row <- Rows],
Selected = maps:from_list(lists:zip(NColumns, NRows)),
case emqx_authn_utils:check_password(Password, Selected, State) of
ok ->
{ok, emqx_authn_utils:is_superuser(Selected)};