diff --git a/amt/api/navigation.py b/amt/api/navigation.py index 56eb8b2b9..b3089e6ae 100644 --- a/amt/api/navigation.py +++ b/amt/api/navigation.py @@ -90,7 +90,6 @@ def get_display_text(self, translations: NullTranslations | None = None) -> str: class Navigation: - HOMEPAGE = BaseNavigationItem(display_text=DisplayText.HOME, url="/", icon="rvo-icon-home") PROJECTS_ROOT = BaseNavigationItem( display_text=DisplayText.PROJECTS, url=["/projects/", "/project/"], icon="rvo-icon-publicatie" ) @@ -236,7 +235,6 @@ def resolve_navigation_items( def get_main_menu(request: Request, translations: NullTranslations) -> list[NavigationItem]: # main menu items are the same for all pages main_menu_items = [ - NavigationItem(Navigation.HOMEPAGE, translations=translations), NavigationItem(Navigation.PROJECTS_ROOT, translations=translations), ] diff --git a/amt/api/routes/auth.py b/amt/api/routes/auth.py index ee40bc814..1003dd69e 100644 --- a/amt/api/routes/auth.py +++ b/amt/api/routes/auth.py @@ -6,6 +6,7 @@ from fastapi import APIRouter, Request from fastapi.responses import HTMLResponse, RedirectResponse, Response +from amt.api.deps import templates from amt.core.authorization import get_user from amt.core.exceptions import AMTAuthorizationFlowError @@ -60,4 +61,11 @@ async def auth_callback(request: Request) -> Response: # pragma: no cover if user: request.session["user"] = dict(user) # type: ignore request.session["id_token"] = token["id_token"] # type: ignore - return RedirectResponse(url="/") + return RedirectResponse(url="/projects/") + + +@router.get("/profile", response_class=Response) +async def auth_profile(request: Request) -> HTMLResponse: + user = get_user(request) + + return templates.TemplateResponse(request, "auth/profile.html.j2", {"user": user}) diff --git a/amt/locale/base.pot b/amt/locale/base.pot index 9b93309f5..a7e53ed3c 100644 --- a/amt/locale/base.pot +++ b/amt/locale/base.pot @@ -85,7 +85,7 @@ msgstr "" msgid "Projects" msgstr "" -#: amt/api/navigation.py:47 +#: amt/api/navigation.py:47 amt/site/templates/auth/profile.html.j2:10 msgid "Overview" msgstr "" @@ -185,6 +185,32 @@ msgid "" "later." msgstr "" +#: amt/site/templates/auth/profile.html.j2:10 +msgid "of" +msgstr "" + +#: amt/site/templates/auth/profile.html.j2:18 +msgid "Logout" +msgstr "" + +#: amt/site/templates/auth/profile.html.j2:30 +msgid "Edit image" +msgstr "" + +#: amt/site/templates/auth/profile.html.j2:34 +msgid "Name" +msgstr "" + +#: amt/site/templates/auth/profile.html.j2:37 +msgid "Email" +msgstr "" + +#: amt/site/templates/auth/profile.html.j2:40 +#: amt/site/templates/parts/header.html.j2:92 +#: amt/site/templates/parts/header.html.j2:151 +msgid "Language" +msgstr "" + #: amt/site/templates/errors/AMTAuthorizationError_401.html.j2:5 msgid "Not logged in" msgstr "" @@ -194,8 +220,9 @@ msgid "Please login to view this page" msgstr "" #: amt/site/templates/errors/AMTAuthorizationError_401.html.j2:11 -#: amt/site/templates/parts/header.html.j2:100 -#: amt/site/templates/parts/header.html.j2:154 +#: amt/site/templates/pages/landingpage.html.j2:16 +#: amt/site/templates/parts/header.html.j2:103 +#: amt/site/templates/parts/header.html.j2:161 msgid "Login" msgstr "" @@ -274,6 +301,7 @@ msgstr "" msgid "AMT Placeholder informatie pagina's" msgstr "" +#: amt/site/templates/pages/landingpage.html.j2:12 #: amt/site/templates/parts/footer.html.j2:4 #: amt/site/templates/parts/header.html.j2:8 msgid "Algorithm Management Toolkit" @@ -305,16 +333,6 @@ msgstr "" msgid "Everyone is welcome to make comments and suggestions." msgstr "" -#: amt/site/templates/parts/header.html.j2:88 -#: amt/site/templates/parts/header.html.j2:143 -msgid "Language" -msgstr "" - -#: amt/site/templates/parts/header.html.j2:109 -#: amt/site/templates/parts/header.html.j2:162 -msgid "Logout" -msgstr "" - #: amt/site/templates/projects/details_base.html.j2:3 #: amt/site/templates/projects/details_data.html.j2:3 #: amt/site/templates/projects/details_info.html.j2:3 diff --git a/amt/locale/en_US/LC_MESSAGES/messages.po b/amt/locale/en_US/LC_MESSAGES/messages.po index ea829d7c6..28eeecf33 100644 --- a/amt/locale/en_US/LC_MESSAGES/messages.po +++ b/amt/locale/en_US/LC_MESSAGES/messages.po @@ -86,7 +86,7 @@ msgstr "" msgid "Projects" msgstr "" -#: amt/api/navigation.py:47 +#: amt/api/navigation.py:47 amt/site/templates/auth/profile.html.j2:10 msgid "Overview" msgstr "" @@ -186,6 +186,32 @@ msgid "" "later." msgstr "" +#: amt/site/templates/auth/profile.html.j2:10 +msgid "of" +msgstr "" + +#: amt/site/templates/auth/profile.html.j2:18 +msgid "Logout" +msgstr "" + +#: amt/site/templates/auth/profile.html.j2:30 +msgid "Edit image" +msgstr "" + +#: amt/site/templates/auth/profile.html.j2:34 +msgid "Name" +msgstr "" + +#: amt/site/templates/auth/profile.html.j2:37 +msgid "Email" +msgstr "" + +#: amt/site/templates/auth/profile.html.j2:40 +#: amt/site/templates/parts/header.html.j2:92 +#: amt/site/templates/parts/header.html.j2:151 +msgid "Language" +msgstr "" + #: amt/site/templates/errors/AMTAuthorizationError_401.html.j2:5 msgid "Not logged in" msgstr "" @@ -195,8 +221,9 @@ msgid "Please login to view this page" msgstr "" #: amt/site/templates/errors/AMTAuthorizationError_401.html.j2:11 -#: amt/site/templates/parts/header.html.j2:100 -#: amt/site/templates/parts/header.html.j2:154 +#: amt/site/templates/pages/landingpage.html.j2:16 +#: amt/site/templates/parts/header.html.j2:103 +#: amt/site/templates/parts/header.html.j2:161 msgid "Login" msgstr "" @@ -275,6 +302,7 @@ msgstr "" msgid "AMT Placeholder informatie pagina's" msgstr "" +#: amt/site/templates/pages/landingpage.html.j2:12 #: amt/site/templates/parts/footer.html.j2:4 #: amt/site/templates/parts/header.html.j2:8 msgid "Algorithm Management Toolkit" @@ -306,16 +334,6 @@ msgstr "" msgid "Everyone is welcome to make comments and suggestions." msgstr "" -#: amt/site/templates/parts/header.html.j2:88 -#: amt/site/templates/parts/header.html.j2:143 -msgid "Language" -msgstr "" - -#: amt/site/templates/parts/header.html.j2:109 -#: amt/site/templates/parts/header.html.j2:162 -msgid "Logout" -msgstr "" - #: amt/site/templates/projects/details_base.html.j2:3 #: amt/site/templates/projects/details_data.html.j2:3 #: amt/site/templates/projects/details_info.html.j2:3 @@ -448,3 +466,6 @@ msgstr "" msgid "Copy results and close" msgstr "" +#~ msgid "Algortime Management Toolkit" +#~ msgstr "" + diff --git a/amt/locale/nl_NL/LC_MESSAGES/messages.mo b/amt/locale/nl_NL/LC_MESSAGES/messages.mo index 3ad38dca3..0a0aa8373 100644 Binary files a/amt/locale/nl_NL/LC_MESSAGES/messages.mo and b/amt/locale/nl_NL/LC_MESSAGES/messages.mo differ diff --git a/amt/locale/nl_NL/LC_MESSAGES/messages.po b/amt/locale/nl_NL/LC_MESSAGES/messages.po index dd1be73ff..478965fe7 100644 --- a/amt/locale/nl_NL/LC_MESSAGES/messages.po +++ b/amt/locale/nl_NL/LC_MESSAGES/messages.po @@ -86,7 +86,7 @@ msgstr "Start" msgid "Projects" msgstr "Projecten" -#: amt/api/navigation.py:47 +#: amt/api/navigation.py:47 amt/site/templates/auth/profile.html.j2:10 msgid "Overview" msgstr "Overzicht" @@ -194,6 +194,32 @@ msgstr "" "Er is iets fout gegaan tijdens de autorisatiestroom. Probeer het later " "opnieuw" +#: amt/site/templates/auth/profile.html.j2:10 +msgid "of" +msgstr "van" + +#: amt/site/templates/auth/profile.html.j2:18 +msgid "Logout" +msgstr "Uitloggen" + +#: amt/site/templates/auth/profile.html.j2:30 +msgid "Edit image" +msgstr "Afbeelding aanpassen" + +#: amt/site/templates/auth/profile.html.j2:34 +msgid "Name" +msgstr "Naam" + +#: amt/site/templates/auth/profile.html.j2:37 +msgid "Email" +msgstr "Email" + +#: amt/site/templates/auth/profile.html.j2:40 +#: amt/site/templates/parts/header.html.j2:92 +#: amt/site/templates/parts/header.html.j2:151 +msgid "Language" +msgstr "Taal" + #: amt/site/templates/errors/AMTAuthorizationError_401.html.j2:5 msgid "Not logged in" msgstr "Niet ingelogd" @@ -203,8 +229,9 @@ msgid "Please login to view this page" msgstr "Meld u aan om deze pagina te bekijken" #: amt/site/templates/errors/AMTAuthorizationError_401.html.j2:11 -#: amt/site/templates/parts/header.html.j2:100 -#: amt/site/templates/parts/header.html.j2:154 +#: amt/site/templates/pages/landingpage.html.j2:16 +#: amt/site/templates/parts/header.html.j2:103 +#: amt/site/templates/parts/header.html.j2:161 msgid "Login" msgstr "Inloggen" @@ -283,6 +310,7 @@ msgstr "Antwoord" msgid "AMT Placeholder informatie pagina's" msgstr "AMT Placeholder informatie pagina's" +#: amt/site/templates/pages/landingpage.html.j2:12 #: amt/site/templates/parts/footer.html.j2:4 #: amt/site/templates/parts/header.html.j2:8 msgid "Algorithm Management Toolkit" @@ -314,16 +342,6 @@ msgstr "Deze website is in ontwikkeling. Alle versies ontstaan op een open manie msgid "Everyone is welcome to make comments and suggestions." msgstr "Iedereen mag opmerkingen en suggesties doen." -#: amt/site/templates/parts/header.html.j2:88 -#: amt/site/templates/parts/header.html.j2:143 -msgid "Language" -msgstr "Taal" - -#: amt/site/templates/parts/header.html.j2:109 -#: amt/site/templates/parts/header.html.j2:162 -msgid "Logout" -msgstr "Uitloggen" - #: amt/site/templates/projects/details_base.html.j2:3 #: amt/site/templates/projects/details_data.html.j2:3 #: amt/site/templates/projects/details_info.html.j2:3 @@ -461,3 +479,6 @@ msgstr "Maak project" msgid "Copy results and close" msgstr "Resultaten overnemen en sluiten" +#~ msgid "Algortime Management Toolkit" +#~ msgstr "Algoritme Management Toolkit" + diff --git a/amt/middleware/authorization.py b/amt/middleware/authorization.py index 623c06aa6..58fb06c4f 100644 --- a/amt/middleware/authorization.py +++ b/amt/middleware/authorization.py @@ -3,10 +3,9 @@ from starlette.middleware.base import BaseHTTPMiddleware from starlette.requests import Request -from starlette.responses import Response +from starlette.responses import RedirectResponse, Response from amt.core.authorization import get_user -from amt.core.exceptions import AMTAuthorizationError RequestResponseEndpoint = typing.Callable[[Request], typing.Awaitable[Response]] @@ -30,4 +29,4 @@ async def dispatch(self, request: Request, call_next: RequestResponseEndpoint) - if auth_disable: return response - raise AMTAuthorizationError() + return RedirectResponse(url="/") diff --git a/amt/site/static/images/berichtenbox-bedrijven.jpg b/amt/site/static/images/berichtenbox-bedrijven.jpg new file mode 100644 index 000000000..50267c952 Binary files /dev/null and b/amt/site/static/images/berichtenbox-bedrijven.jpg differ diff --git a/amt/site/templates/auth/profile.html.j2 b/amt/site/templates/auth/profile.html.j2 new file mode 100644 index 000000000..965d94020 --- /dev/null +++ b/amt/site/templates/auth/profile.html.j2 @@ -0,0 +1,45 @@ +{% extends 'layouts/base.html.j2' %} +{% block content %} + {% set language_mappings = {"nl": "Nederlands", "en": "English"} %} +
+ Lorem ipsum dolor sit, amet consectetur adipisicing elit. Praesentium, minus quia fuga temporibus aspernatur optio doloribus nisi iusto, provident dolore velit ratione quam dicta pariatur consequuntur, ipsa reprehenderit accusantium in. +
++ A, ipsa distinctio molestias exercitationem corporis eum ea molestiae temporibus sequi doloremque amet officia ullam dolore earum! Illum dolores ipsa necessitatibus excepturi ex reprehenderit ad cupiditate. Aperiam rerum esse id? +
+- De Algoritme Management Toolkit is ... Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam accumsan eros at nisi volutpat, at sagittis ipsum sodales. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Aenean cursus, enim ac sollicitudin vestibulum, ante urna sollicitudin ex, ut mollis neque ipsum nec dui. Vestibulum maximus sapien euismod nulla commodo, et dignissim augue tempus. Morbi eleifend lacus in augue semper, at condimentum purus luctus. Nullam vel dolor lorem. Nam cursus tincidunt lacus, ut pharetra tortor cursus et. Etiam eu tortor at neque convallis imperdiet. -