예제 #1
0
def login():
    db.connect()
    if request.method == 'POST':
        password = db.select_password(request.form["username"])

        form_pass = request.form["password"]
        if password != form_pass:
            return redirect('/login')

        else:
            session['username'] = request.form["username"]
            return redirect('/')
    else:
        db.close()
        return render_template('login.html')
예제 #2
0
파일: fob.py 프로젝트: georgejdanforth/fob
def retreive_password():
    fob_password = get_fob_password()
    if crypto.hash_fob_password(fob_password) != db.select_single(
            "fob_passwords"):
        sys.exit("Incorrect password.")

    service_name = input("Service Name: ")
    account_name = input("Account Name: ")

    result = db.select_password(service_name, account_name)
    if result is None:
        sys.exit("Account not found.")

    result = {
        key: result[key]
        for key in result.keys() if key != "password_id"
    }
    result["password"] = str(crypto.decrypt(fob_password, result["password"]))

    write_read_password_tempfile(result)
예제 #3
0
파일: fob.py 프로젝트: georgejdanforth/fob
def add_password():
    fob_password = get_fob_password()
    if crypto.hash_fob_password(fob_password) != db.select_single(
            "fob_passwords"):
        sys.exit("Incorrect password.")

    service_name = input("Service Name: ")
    service_url = input("Service URL: ")
    account_name = input("Account Name: ")

    existing_accounts = db.select_password(service_name, account_name)

    if existing_accounts is not None:
        sys.exit("Password already exists for account: '" + account_name + "'")

    password = bytes_input("Password: "******"passwords",
              "(service_name, service_url, account_name, password)",
              (service_name, service_url, account_name, hashed_password))