From fa0cd01a59095bb781663876f334523ed6f40b07 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Sun, 27 Dec 2020 21:50:34 +0200 Subject: [PATCH] Authentication: implement part of get_dashboard_url. --- etebase_fastapi/authentication.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/etebase_fastapi/authentication.py b/etebase_fastapi/authentication.py index a8fbbfe..13af2dd 100644 --- a/etebase_fastapi/authentication.py +++ b/etebase_fastapi/authentication.py @@ -268,6 +268,19 @@ async def change_password(data: ChangePassword, request: Request, user: User = D return Response(status_code=status.HTTP_204_NO_CONTENT) +@authentication_router.post("/dashboard_url/") +def dashboard_url(user: User = Depends(get_authenticated_user)): + # XXX-TOM + get_dashboard_url = app_settings.DASHBOARD_URL_FUNC + if get_dashboard_url is None: + raise ValidationError("not_supported", "This server doesn't have a user dashboard.") + + ret = { + "url": get_dashboard_url(request, *args, **kwargs), + } + return MsgpackResponse(ret) + + def signup_save(data: SignupIn, request: Request) -> User: user_data = data.user with transaction.atomic():