This repository has been archived on 2024-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
gemini-auth/public/cgi/index.gmi

26 lines
612 B
Plaintext
Executable File

#!/usr/bin/python3
# This is just a little example of home page, change it as you see fit.
import os
import sys
os.chdir('..')
sys.path.append('lib')
hash = os.environ.get('TLS_CLIENT_HASH')
if (not hash):
print('60 Authentication is required\r\n')
exit()
print('20 text/gemini\r\n')
from auth import auth
auth = auth('data/data.db')
auth.passKey(hash)
print('Your hash:', auth.hash)
if (auth.username):
print('Your username:', auth.username)
print('=> account/index.gmi Manage your account')
else:
print('=> account/register.gmi register')
print('=> link.gmi link existing account')