let context overwrite global
add needlogin helper function