create SQL function "change_user_password"

This commit is contained in:
2019-10-09 12:27:20 +02:00
parent f91b25b35b
commit 20416ce108
2 changed files with 19 additions and 0 deletions

View File

@@ -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);