use postgres to do password verification

This is the first step to moving authentication into a function