summaryrefslogtreecommitdiff
path: root/sql/functions/auth.update_password.sql
diff options
context:
space:
mode:
authorckonstanski <carlos.konstanski@olo.com>2024-05-25 18:03:25 -0600
committerckonstanski <carlos.konstanski@olo.com>2024-05-25 18:03:25 -0600
commitb8423f4d05c75094b7b9d09c6f0bb353acc9be1c (patch)
tree3732f71f84191b26f038130c2220fb502d738251 /sql/functions/auth.update_password.sql
initial commit
Diffstat (limited to 'sql/functions/auth.update_password.sql')
-rw-r--r--sql/functions/auth.update_password.sql19
1 files changed, 19 insertions, 0 deletions
diff --git a/sql/functions/auth.update_password.sql b/sql/functions/auth.update_password.sql
new file mode 100644
index 0000000..8dc730c
--- /dev/null
+++ b/sql/functions/auth.update_password.sql
@@ -0,0 +1,19 @@
+drop function auth.update_password (
+ p_id bigint,
+ p_pwd character varying
+);
+
+create or replace function auth.update_password (
+ p_id bigint,
+ p_pwd character varying
+)
+returns bigint
+as $$
+begin
+ update auth.users
+ set pwd = digest(p_pwd, 'sha512')
+ where id = p_id;
+
+ return p_id;
+end;
+$$ language plpgsql;