Added function to check login status