def bumpTokenChain(device, agreement, token): # ONLY TO BE CALLED AFTER AUTH! (tr, tok) = next_token(token) assrt( tr, "(bumpTokenChain): faied to generate next token from previous - " + token) storage.setToken(agreement, device, tok) return tok
def initTokenChain(device, agreement, password): h = storage.getPasswordHash(agreement) if h is None: return (False, "Non-existing user") h = h[0] print(password) print(hash_password(password)) print(h) if hash_password(password) == h: (tr, tok) = next_token(h) assrt(tr, "(initTokenChain): Token generator failure. We're very f****d!") storage.ensureDevice(device) storage.setToken(agreement, device, tok) return (True, tok) else: # inc_login_fail(agreement) # We want to eventually protect ourselves vs bruteforce return (False, "Wrong password.")
def initTokenChain(device, agreement, password): h = storage.getPasswordHash(agreement) if h is None: return (False, "Non-existing user") h = h[0] print(password) print(hash_password(password)) print(h) if hash_password(password) == h: (tr, tok) = next_token(h) assrt(tr, "(initTokenChain): Token generator failure. We're very f****d!") storage.ensureDevice(device) storage.setToken(agreement, device, tok) return (True, tok) else: #inc_login_fail(agreement) # We want to eventually protect ourselves vs bruteforce return (False, "Wrong password.")
def bumpTokenChain(device, agreement, token): # ONLY TO BE CALLED AFTER AUTH! (tr, tok) = next_token(token) assrt(tr, "(bumpTokenChain): faied to generate next token from previous - " + token) storage.setToken(agreement, device, tok) return tok