示例#1
0
def disconnect():
    """ Log off the current user """
    get_session().loggedin = False
    get_session().username = None
    get_session().realname = None
    get_session().email = None
    return
示例#2
0
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)
示例#3
0
def is_logged_in():
    """" Returns if the user is logged in or not """
    return "loggedin" in get_session() and get_session().loggedin
示例#4
0
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
示例#5
0
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
示例#6
0
def get_data():
    """ Get the User Data for the connected user """
    if not is_logged_in():
        return None
    return UserData(get_session().username)