Exemplo n.º 1
0
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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
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
Exemplo n.º 4
0
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
Exemplo n.º 5
0
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