Added login and user middleware