Optimized login

Added a global js var for first layer user logged in check