#!/usr/bin/env python3

# modules are all in the parent directory
import sys
sys.path.append('..')

# import helpers from modules
from helpers import get_client_cert, get_query_string
from db import add_cert_to_user

tls_client_hash = get_client_cert(False)
key_code = get_query_string("What is your auth code?")
success = add_cert_to_user(key_code, tls_client_hash)

print("# Add Cert Page")
print()

if success:
    print("Your new key has been added to this account. Congratulations!")
else:
    print("Either your auth code is incorrect or something else has gone wrong.")
print()
print("=> ../login Back to main page")


#vim:fenc=utf-8:ts=4:sw=4:sta:noet:sts=4:fdm=marker:ai
