def disconnect(): """ Log off the current user """ get_session().loggedin = False get_session().username = None get_session().realname = None get_session().email = None return
def connect_user_internal(username, email, realname): """ Connect a user. Should only be used by plugins to effectively connect the user. **this function does not make any verifications!** """ get_session().loggedin = True get_session().email = email get_session().username = username get_session().realname = realname get_data().update_basic_informations(get_session().realname, get_session().email)
def is_logged_in(): """" Returns if the user is logged in or not """ return "loggedin" in get_session() and get_session().loggedin
def get_realname(): """ Returns the real name of the current user. Returns None if no user is logged in """ if not is_logged_in(): return None return get_session().realname
def get_username(): """ Returns the username (which is unique) of the current user. Returns None if no user is logged in """ if not is_logged_in(): return None return get_session().username
def get_data(): """ Get the User Data for the connected user """ if not is_logged_in(): return None return UserData(get_session().username)