#!/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, id_generator
from db import check_hash, set_add_key_code

TLS_CLIENT_HASH = get_client_cert()
user_id = check_hash(TLS_CLIENT_HASH)
key_code = id_generator()
set_add_key_code(user_id, key_code)

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

print("Your authorization code to add new client certificates has been updated. Visit the 'Add Cert' page from another device or with another key and enter your authorization code to connect the accounts.")
print()
print("## AUTH CODE")
print(key_code)
print("=> ../add-cert/?" + key_code + " Link to Add Cert page with Auth Code")
print()
print("=> ../login Back to main page")


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