profile and other stuff

This commit is contained in:
2019-08-14 16:38:03 +02:00
parent 859a5d880a
commit 9ab0d43f43
16 changed files with 297 additions and 624 deletions

View File

@@ -8,7 +8,7 @@ Login through API does not start a new session, but instead returns JWT.
import json
from datetime import datetime
from flask_jwt_extended import jwt_required
from flask_jwt_extended import jwt_required, get_current_user, get_jwt_claims
from flask_restplus import fields, Resource
from backend import db
@@ -35,6 +35,8 @@ class ControlCommand(Resource):
@api_control.expect(control_command_parser)
@api_control.marshal_with(control_command_response_model, skip_none=False, code=201)
def post(self):
current_user = {'identity': get_jwt_identity(), 'type': type(get_jwt_identity())}
print(get_current_user())
print(get_jwt_identity())
current_user = {'user': get_current_user(), 'claims': get_jwt_claims()}
args = self.control_command_parser.parse_args()
return {'time': datetime.utcnow(), 'output': args, 'state': current_user}