Added session validation and added new routes for login and register