token stuff, 3
This commit is contained in:
parent
6a9b938ab9
commit
e4fe5b9831
@ -5,6 +5,7 @@ from werkzeug.middleware.proxy_fix import ProxyFix
|
||||
import os
|
||||
import json
|
||||
import psycopg2
|
||||
import logging
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config.update({
|
||||
@ -18,6 +19,7 @@ app.config.update({
|
||||
})
|
||||
|
||||
oidc = OpenIDConnect(app)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
@ -107,6 +109,8 @@ def convert_decimal(value):
|
||||
@app.route('/add_nutrition', methods=['POST'])
|
||||
@oidc.accept_token(['openid'])
|
||||
def add_nutrition():
|
||||
logger.info("add_nutrition")
|
||||
|
||||
food = request.form.get('food')
|
||||
kcal = convert_decimal(request.form.get('kcal'))
|
||||
ew = convert_decimal(request.form.get('ew'))
|
||||
@ -132,6 +136,7 @@ def add_nutrition():
|
||||
@app.route('/nutrition')
|
||||
@oidc.require_login
|
||||
def nutrition():
|
||||
logger.info("nutrition")
|
||||
return render_template('nutrition.html')
|
||||
|
||||
@app.route('/get_token')
|
||||
|
Loading…
x
Reference in New Issue
Block a user