1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00
Files
AdministrationItDepartmens/.bolt/supabase_discarded_migrations/0008_wooden_star.sql
MoonTestUse1 e81df4c87e Initial commit
2024-12-23 19:27:44 +06:00

27 lines
555 B
PL/PgSQL

/*
# Password Management Functions
1. New Functions
- Password hashing and verification utilities
- Secure password management
*/
-- Create password hashing function
CREATE OR REPLACE FUNCTION hash_password(password text)
RETURNS text
LANGUAGE plpgsql
AS $$
BEGIN
RETURN crypt(password, gen_salt('bf'));
END;
$$;
-- Create password verification function
CREATE OR REPLACE FUNCTION verify_password(stored_hash text, password text)
RETURNS boolean
LANGUAGE plpgsql
AS $$
BEGIN
RETURN stored_hash = crypt(password, stored_hash);
END;
$$;