-
Notifications
You must be signed in to change notification settings - Fork 0
/
views.py
72 lines (56 loc) · 1.91 KB
/
views.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import random
import string
from __init__ import app
from flask import render_template, Response, request
from twilio.rest import TwilioRestClient
from qr import qr_generator
@app.route('/')
def index():
return render_template("index.html")
@app.route('/choose')
def choose():
return render_template("choose_to_prove.html")
@app.route('/searchforproperty')
def searchforproperty():
return render_template('search_for_property.html')
@app.route('/checkproperty')
def check_property():
return render_template('check_property.html')
@app.route('/reference')
def reference():
code = code_generator()
qr_generator.generate_qr_code(code)
return render_template('reference.html', code=code)
@app.route('/login')
def login():
return render_template('choose_to_prove.html')
@app.route('/sendsms', methods=['POST'])
def send_sms():
# put your own credentials in a config.py
ACCOUNT_SID = app.config['ACCOUNT_SID']
AUTH_TOKEN = app.config['AUTH_TOKEN']
ref_code = request.form.get('ref_code')
client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
client.messages.create(
to=app.config['TO_TEST_NUMBER'],
from_=app.config['FROM_TEST_NUMBER'],
body="your reference is " + ref_code
)
return Response("message sent", status=200)
@app.route('/base')
def base():
return render_template('global/base.html')
def code_generator(size=8, chars=(string.ascii_uppercase + string.digits)):
return ''.join(random.choice(chars) for _ in range(size))
@app.route('/checkproof')
def check_proof():
return render_template('check_proof.html')
@app.route('/checkreference')
def check_reference():
return render_template('property_owned_confirmation.html')
@app.route('/checkreference/<code>')
def check_ref_code(code):
return render_template('property_owned_confirmation.html')
@app.route('/fishfail')
def fishfail():
return render_template('fishfail.html')