def create_user(db, username, password): random_s = random_salt() user = User( username=username, salt=random_s, password=hash_pbkdf2(password, random_s), coins=100, ) db.add(user) return user
def create_user(db, username, password): user = User( username=username, password=password, coins=100, ) user.salt = random_salt() user.password = hash_pbkdf2(user.password, user.salt) db.add(user) return user
def create_user(db, username, password): # keep signature unchanged salt = random_salt() salted_password = hash_pbkdf2(password, salt) user = User( username=username, password=salted_password, salt=salt, coins=100, ) db.add(user) return user
def create_user(db, username, password): # TODO: Ex2.2: salt password salt = random_salt() salted_pwd = hash_pbkdf2(password, salt) user = User( username=username, salted_password=salted_pwd, salt=salt, coins=100, ) db.add(user) return user
def create_user(db, username, password): #generate salt gen_salt = random_salt() #hash password salted_password = hash_pbkdf2(password, gen_salt) user = User( username=username, password=salted_password, coins=100, salt=gen_salt, ) db.add(user) return user