Пример #1
0
def authUser(uname, pwd):
    pwdHash = Encryption.pwdHash(pwd)
    if Database.isValid(uname,pwdHash):
        token = Encryption.sessionToken()

        #It's almost impossibly unlikely that we'll wind up with two identical tokens,
        #but if we did, it would be a hard bug to find.
        while token in validTokens:
            token = Encryption.sessionToken()
        validTokens[token] = uname
        return token
    return False
Пример #2
0
def authUser(uname, pwd):
    pwdHash = Encryption.pwdHash(pwd)
    if Database.isValid(uname,pwdHash):
        token = Encryption.sessionToken()

        #It's almost impossibly unlikely that we'll wind up with two identical tokens,
        #but if we did, it would be a hard bug to find.
        while not memcache.get(token) == None:
            token = Encryption.sessionToken()
        memcache.set(key=token, value=uname, time=KEY_STORE_TIME)
        return token
    return False