create SQL function "change_user_password"

This commit is contained in:
flecomte committed 2019-10-09 12:27:20 +02:00
1 parent f91b25b35b
commit 20416ce108
2 files changed
+19

No files matched your search

@@ -0,0 +1,12 @@
create or replace function change_user_password(resource json) returns void language plpgsql as
$$
begin
update "user"
set password = crypt(resource->>'plain_password', gen_salt('bf', 8))
where id = (resource->>'id')::uuid;
return;
end;
$$;
-- drop function if exists change_user_password(json);