added login code, implemented login status