add user registration function into a postgres function

this removes the dependency upon passwordhash