Moved require to after login check to allow redirect