added new code for user authentication