added user model and method to authenticate user
refactored the authenticate method