Login function update

updated to use new db format