feat: password confirmation

This commit is contained in:
cellarspoon
2022-01-10 10:17:35 +01:00
parent e50ffa50ee
commit de207e3153
4 changed files with 32 additions and 8 deletions

View File

@ -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: