Example #1
0
def update_user(user, passwd, db):
    """ Change the users pass in the DB """
    db_dict = anydbm.open(db, "w")
    if user in db_dict:
        db_dict[user] = htpasswd.hash_password(passwd)
        db_dict.close()
        return True
    else:
        return False
Example #2
0
def add_user(user, passwd, db):
    """ Add user to the DB, creating if need be """
    db_dict = anydbm.open(db, "c")
    db_dict[user] = htpasswd.hash_password(passwd)
    db_dict.close()
    return True