Beispiel #1
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'})
Beispiel #2
0
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
Beispiel #3
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({