From 08e435104c42751689553537b1f20ffb14b8dfcc Mon Sep 17 00:00:00 2001 From: ckonstanski Date: Sat, 18 Jul 2026 21:18:18 -0600 Subject: initial commit --- .../auth.get_active_user_by_username_pwd.sql | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 sql/functions/auth.get_active_user_by_username_pwd.sql (limited to 'sql/functions/auth.get_active_user_by_username_pwd.sql') diff --git a/sql/functions/auth.get_active_user_by_username_pwd.sql b/sql/functions/auth.get_active_user_by_username_pwd.sql new file mode 100644 index 0000000..138234a --- /dev/null +++ b/sql/functions/auth.get_active_user_by_username_pwd.sql @@ -0,0 +1,30 @@ +drop function auth.get_active_user_by_username_pwd ( + p_username character varying, + p_pwd character varying +); + +create or replace function auth.get_active_user_by_username_pwd ( + p_username character varying, + p_pwd character varying +) +returns setof auth.users +as $$ +begin + return query + select u.id, + u.username, + u.pwd, + u.first_name, + u.last_name, + u.email, + u.phone, + u.active, + u.created + from auth.users u + where u.username = p_username + and u.pwd = digest(p_pwd, 'sha512') + and u.active = true; + + return; +end; +$$ language plpgsql; -- cgit v1.3