diff --git a/keycloak_collective_portal/routes/register.py b/keycloak_collective_portal/routes/register.py index e2b38c4..2c4368c 100644 --- a/keycloak_collective_portal/routes/register.py +++ b/keycloak_collective_portal/routes/register.py @@ -44,7 +44,7 @@ async def register_invite( "invalid.html", context=context ) - context = {"request": request, "username": username} + context = {"request": request, "invited_by": username} return request.app.state.templates.TemplateResponse( "register.html", context=context ) @@ -58,9 +58,24 @@ def form_keycloak_register( username: str = Form(...), email: str = Form(...), password: str = Form(...), + password_again: str = Form(...), invited_by: str = Form(...), ): + if password != password_again: + context = { + "request": request, + "exception": "passwords don't match?", + "invited_by": invited_by, + "first_name": first_name, + "last_name": last_name, + "username": username, + "email": email, + } + return request.app.state.templates.TemplateResponse( + "register.html", context=context + ) + payload = { "email": email, "username": username, @@ -76,7 +91,7 @@ def form_keycloak_register( "realmRoles": [ "user_default", ], - "attributes": {"invited_by": username}, + "attributes": {"invited_by": invited_by}, } try: diff --git a/keycloak_collective_portal/static/default.css b/keycloak_collective_portal/static/default.css index 7fab53f..019aa5d 100644 --- a/keycloak_collective_portal/static/default.css +++ b/keycloak_collective_portal/static/default.css @@ -1,5 +1,6 @@ input { display: block; + margin-top: 5px; margin-bottom: 15px; } diff --git a/keycloak_collective_portal/static/lumbung.css b/keycloak_collective_portal/static/lumbung.css index 7fab53f..019aa5d 100644 --- a/keycloak_collective_portal/static/lumbung.css +++ b/keycloak_collective_portal/static/lumbung.css @@ -1,5 +1,6 @@ input { display: block; + margin-top: 5px; margin-bottom: 15px; } diff --git a/keycloak_collective_portal/templates/register.html b/keycloak_collective_portal/templates/register.html index 51d7fb9..a6d150a 100644 --- a/keycloak_collective_portal/templates/register.html +++ b/keycloak_collective_portal/templates/register.html @@ -1,26 +1,33 @@ {% extends "base.html" %} {% block content %}

- You've been invited by {{ username }} 🎉 + You've been invited by {{ invited_by }} 🎉

+ {% if exception %} +

Oops, something went wrong: {{ exception }} 😬

+ {% endif %} +
- + - + - + - + - + + + +