Commit 6386fc33 by Oleksandr Barabash

json parser fixed

parent bdfc343a
......@@ -15,7 +15,7 @@ from botbuilder.core import (
BotFrameworkAdapter,
)
from botbuilder.schema import Activity, ActivityTypes
from marshmallow import EXCLUDE
from marshmallow import EXCLUDE, ValidationError
from bots import TeamsMessagingExtensionsActionPreviewBot
from bots.exceptions import ConversationNotFound, DataParsingError
......@@ -199,11 +199,14 @@ async def v1_auth(request: Request) -> Response:
body = await request.json()
else:
return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE)
try:
admin_user = AdminUser.Schema().load(body)
if admin_user.login and admin_user.password:
result = await TOKEN_HELPER.do_auth(admin_user)
if result is not None:
return Response(status=HTTPStatus.OK, body=json_dumps(result))
except ValidationError:
pass
return Response(status=HTTPStatus.FORBIDDEN)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment