Hey! I'm trying to encrypt passwords by using a tr...
# help
m
Hey! I'm trying to encrypt passwords by using a trigger function that stores the user metadata to a table called Users, but the following fails. Am I missing something?
Copy code
begin

  insert into public."Users" (id, email , name, phone_1, phone_2, id_condo, address, birthday, password  )
  values (
  new.id, 
  new.email, 
  new.raw_user_meta_data->>'name', 
  new.raw_user_meta_data->>'phone_1', 
  new.raw_user_meta_data->>'phone_2',
  (new.raw_user_meta_data->>'id_condo'::text)::uuid,
   new.raw_user_meta_data->'address',
    CAST (new.raw_user_meta_data->>'birthday' as DATE),
    crypt(new.password, gen_salt('bf'))

  );
  return new;
end;
I was able to fix it myself by adding "extensions" to the search_path of the trigger function.
I needed it to drop function and trigger since I was not sure how to use the alter command for the search_path.
see github issues for more details