Added user authentication logic using session.