-
Notifications
You must be signed in to change notification settings - Fork 0
/
application.py
47 lines (32 loc) · 1007 Bytes
/
application.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
from flask import Flask, render_template, request, jsonify
from flask_cors import CORS
from py.formCadastro import *
from py.authentication import *
application = Flask(__name__)
CORS(application)
@application.route('/')
def main():
return render_template('index.html')
@application.route('/saveNewUser', methods=['POST'])
def saveNewUser():
data = request.get_json()
return saveUser(data)
@application.route('/listForm', methods=['POST'])
def listForm():
authenticate()
return listCadastro()
@application.route('/saveForm', methods=['POST'])
def saveForm():
authenticate()
data = request.get_json()
return jsonify(saveCadastro(data))
def authenticate():
login = request.args.get("login")
userid = request.args.get("userid")
token = request.args.get("token")
if login == 'fb':
return verifyFbToken(token, userid)
elif login == 'gl':
return verifyGlToken(token, userid)
if __name__ == "__main__":
application.run(debug=True)