summaryrefslogtreecommitdiff
path: root/flask1.py
diff options
context:
space:
mode:
authorhc <hc@email.ch>2024-11-20 12:51:33 +0800
committerhc <hc@email.ch>2024-11-20 12:51:33 +0800
commit853b82126baa1e8e408a10f91053c52626ffad29 (patch)
tree2fc1de9695810681ba654aab3c2a4867aacc1ac7 /flask1.py
parentb1f88b682624e85b4b743343dfaaeed113b69413 (diff)
working
Diffstat (limited to 'flask1.py')
-rw-r--r--flask1.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/flask1.py b/flask1.py
new file mode 100644
index 0000000..eb9ff28
--- /dev/null
+++ b/flask1.py
@@ -0,0 +1,38 @@
1from flask import Flask
2from flask import Flask, request, jsonify
3from tfa import *
4
5app = Flask(__name__)
6store = customstore()
7
8@app.route('/')
9def hello_world():
10 return """Hello, World!
11This is an authentication server
12Available directories are:
13/c to create a key
14/a to authorise a key
15/v to verify that a key is authorised
16
17"""
18
19@app.route('/c', methods=['GET'])
20def create():
21 return store.create()
22
23@app.route('/a/<code>', methods=['GET'])
24def authenticate(code):
25 if store.authenticate(code):
26 return "True"
27 else:
28 return "False"
29
30@app.route('/v/<code>', methods=['GET'])
31def verify(code):
32 if store.check(code):
33 return "True"
34 else:
35 return "False"
36
37if __name__ == '__main__':
38 app.run(host='0.0.0.0', port=5000, debug=True)