Base code with login