feat: password confirmation
This commit is contained in:
parent
e50ffa50ee
commit
de207e3153
@ -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:
|
||||
|
@ -1,5 +1,6 @@
|
||||
input {
|
||||
display: block;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
input {
|
||||
display: block;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
|
@ -1,26 +1,33 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<p>
|
||||
You've been invited by {{ username }} 🎉
|
||||
You've been invited by {{ invited_by }} 🎉
|
||||
</p>
|
||||
|
||||
{% if exception %}
|
||||
<p>Oops, something went wrong: {{ exception }} 😬</p>
|
||||
{% endif %}
|
||||
|
||||
<form method="post" action="{{ url_for('form_keycloak_register') }}">
|
||||
<label for="first_name">First name:</label>
|
||||
<input type="text" name="first_name" />
|
||||
<input type="text" name="first_name" value="{{ first_name }}" />
|
||||
|
||||
<label for="last_name">Last name:</label>
|
||||
<input type="text" name="last_name" />
|
||||
<input type="text" name="last_name" value="{{ last_name }}" />
|
||||
|
||||
<label for="username">Username:</label>
|
||||
<input type="text" name="username" />
|
||||
<input type="text" name="username" value="{{ username }}" />
|
||||
|
||||
<label for="email">Email:</label>
|
||||
<input type="text" name="email" />
|
||||
<input type="text" name="email" value="{{ email }}" />
|
||||
|
||||
<label for="password">Password:</label>
|
||||
<input type="password" name="password" />
|
||||
|
||||
<input type="hidden" name="invited_by" value="{{ username }}"/>
|
||||
<label for="password_again">Password (just to be sure):</label>
|
||||
<input type="password" name="password_again" />
|
||||
|
||||
<input type="hidden" name="invited_by" value="{{ invited_by }}"/>
|
||||
|
||||
<input type="submit" value="Register" />
|
||||
</form>
|
||||
|
Loading…
Reference in New Issue
Block a user