refactored db obj and loginValidation