コード例 #1
0
ファイル: websocket.py プロジェクト: Gamer2015/Stuff
async def authenticate(client, dbFileName, message):
    accounts = utilities.unpackAccounts(message["accounts"])
    successful, failed = database.verify(dbFileName, accounts)
    # activeSession = connections.activeSession(entities)
    # anyActive = connections.anyActive(entities)
    # more flexibility possible, but good enough for now
    connections.remember(client, [account["id"] for account in successful])
    await messages.respond(client, message, {
        "successful": utilities.packAccounts(successful),
        "failed": utilities.packAccounts(failed)
    });
コード例 #2
0
async def authenticate(client, dbFileName, message):
    entities = message["entities"]
    success = database.verify(dbFileName, entities)
    #activeSession = connections.activeSession(entities)
    anyActive = connections.anyActive(entities)
    # more flexibility possible, but good enough for now
    if success == False or anyActive == True:
        await messages.respond(client, message, {'status': 'failed'})
    else:
        connections.remember(client, entities)
        await messages.respond(client, message, {'status': 'success'})
コード例 #3
0
ファイル: websocket.py プロジェクト: Gamer2015/Stuff
async def authenticate(websocket, dbFileName, data):
    channels = data["channels"];
    for channel in channels:
        channel["id"] = bytes.fromhex(channel["id"])

    success = database.authenticate(dbFileName, channels)
    if success == False or connections.anyActive(channels) == True:
        await respond(websocket, data, {'status': 'failed'});   
    else:
        connections.remember(websocket, channels);
        await respond(websocket, data, {'status': 'success'});
    return success
コード例 #4
0
async def authenticate(websocket, dbFileName, message):
    channels = message["channels"]
    for channel in channels:
        channel["id"] = bytes.fromhex(channel["id"])

    authInformation = database.authenticate(dbFileName, channels)
    success = all([info["authSuccess"] for info in authInformation])
    #activeSession = connections.activeSession(channels)
    anyActive = connections.anyActive(channels)
    # more flexibility possible, but good enough for now
    if success == False or anyActive == True:
        await messages.respond(websocket, message, {'status': 'failed'})
    else:
        connections.remember(websocket, message["channels"])
        await messages.respond(websocket, message, {'status': 'success'})
        """await websocket.send(json.dumps({