Added user authentication logic.