From ddcf73f4657d4405426466dc8796a9bd1fac3c9b Mon Sep 17 00:00:00 2001 From: zhouzb Date: Thu, 21 Oct 2021 17:41:16 +0800 Subject: [PATCH] fix(authn): fix handling of pgsql response --- apps/emqx_authn/src/simple_authn/emqx_authn_pgsql.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/emqx_authn/src/simple_authn/emqx_authn_pgsql.erl b/apps/emqx_authn/src/simple_authn/emqx_authn_pgsql.erl index 2b8c9b391..d1390697a 100644 --- a/apps/emqx_authn/src/simple_authn/emqx_authn_pgsql.erl +++ b/apps/emqx_authn/src/simple_authn/emqx_authn_pgsql.erl @@ -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)};