Updated login function with ability to track and determine if user is signed in based on global variable g. Also Applied oid to login the user based on valid credentials.