From 9d2b3a39db3d43668a7ab4a48ec642c1068e0963 Mon Sep 17 00:00:00 2001 From: signebedi Date: Thu, 28 Mar 2024 22:47:42 -0500 Subject: [PATCH] Added: placeholder create user and login ui routes (#30) --- libreforms_fastapi/app/__init__.py | 35 ++++++++++++++----- .../app/templates/create_user.html.jinja | 4 +-- .../app/templates/login.html.jinja | 4 +-- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/libreforms_fastapi/app/__init__.py b/libreforms_fastapi/app/__init__.py index 91a5b2a..80522d2 100644 --- a/libreforms_fastapi/app/__init__.py +++ b/libreforms_fastapi/app/__init__.py @@ -1731,11 +1731,33 @@ async def ui_privacy(request: Request): } ) +@app.get("/ui/auth/login", response_class=HTMLResponse) +async def ui_auth_login(request: Request): + if not config.UI_ENABLED: + raise HTTPException(status_code=404, detail="This page does not exist") + + return templates.TemplateResponse( + request=request, + name="login.html.jinja", + context={ + **build_ui_context(), + } + ) + # Create user - # @app.get("/ui/auth/create") - # async def ui_auth_create(): - # if not config.UI_ENABLED: - # raise HTTPException(status_code=404, detail="This page does not exist") +@app.get("/ui/auth/create", response_class=HTMLResponse) +async def ui_auth_create(request: Request): + if not config.UI_ENABLED: + raise HTTPException(status_code=404, detail="This page does not exist") + + return templates.TemplateResponse( + request=request, + name="create_user.html.jinja", + context={ + **build_ui_context(), + } + ) + @@ -1753,11 +1775,6 @@ async def ui_privacy(request: Request): # raise HTTPException(status_code=404, detail="This page does not exist") -# Login - # @app.get("/ui/auth/login") - # async def ui_auth_login(): - # if not config.UI_ENABLED: - # raise HTTPException(status_code=404, detail="This page does not exist") # View profile diff --git a/libreforms_fastapi/app/templates/create_user.html.jinja b/libreforms_fastapi/app/templates/create_user.html.jinja index 8633b57..156f340 100644 --- a/libreforms_fastapi/app/templates/create_user.html.jinja +++ b/libreforms_fastapi/app/templates/create_user.html.jinja @@ -6,7 +6,7 @@ Create User {% block content %}

Create User

-
+
@@ -79,7 +79,7 @@ Create User
-

Already have an account? Login here.

+

Already have an account? Login here.

diff --git a/libreforms_fastapi/app/templates/login.html.jinja b/libreforms_fastapi/app/templates/login.html.jinja index e1f97f8..66278f8 100644 --- a/libreforms_fastapi/app/templates/login.html.jinja +++ b/libreforms_fastapi/app/templates/login.html.jinja @@ -6,7 +6,7 @@ Login {% block content %}

Login

-
+
@@ -34,7 +34,7 @@ Login {% if not config['DISABLE_NEW_USERS'] %}
-

Don't have an account? Create one here.

+

Don't have an account? Create one here.

{% endif %}