Skip to content
Snippets Groups Projects
Commit b7ba166f authored by Martin Mareš's avatar Martin Mareš
Browse files

Opravena editace účastníků a orgů

form.validate_on_submit() se skutečnosti vůbec nekontroluje, že byl
submitnut tento konkrétní formulář. Proto je u endpointů, které obsluhují
více formulářů, nutné kontrolovat i submitovací tlačítko každého
formuláře. A pokud je to <button>, musí mít value, protože jinak se
pošle prázdný řetězec, který se vyhodnotí jako False.
parent c2ac3fc7
Branches
No related tags found
No related merge requests found
...@@ -240,7 +240,7 @@ def org_org(id: int): ...@@ -240,7 +240,7 @@ def org_org(id: int):
resend_invite_form: Optional[ResendInviteForm] = None resend_invite_form: Optional[ResendInviteForm] = None
if rr.can_edit_user(user): if rr.can_edit_user(user):
resend_invite_form = ResendInviteForm() resend_invite_form = ResendInviteForm()
if resend_invite_form.validate_on_submit(): if resend_invite_form.resend_invite.data and resend_invite_form.validate_on_submit():
resend_invite_form.do(user) resend_invite_form.do(user)
return redirect(url_for('org_org', id=id)) return redirect(url_for('org_org', id=id))
...@@ -326,7 +326,7 @@ def org_user(id: int): ...@@ -326,7 +326,7 @@ def org_user(id: int):
resend_invite_form: Optional[ResendInviteForm] = None resend_invite_form: Optional[ResendInviteForm] = None
if rr.can_edit_user(user): if rr.can_edit_user(user):
resend_invite_form = ResendInviteForm() resend_invite_form = ResendInviteForm()
if resend_invite_form.validate_on_submit(): if resend_invite_form.resend_invite.data and resend_invite_form.validate_on_submit():
resend_invite_form.do(user) resend_invite_form.do(user)
return redirect(url_for('org_user', id=id)) return redirect(url_for('org_user', id=id))
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
{% if resend_invite_form %} {% if resend_invite_form %}
<form method=POST class='btn-group' onsubmit='return confirm("Poslat organizátorovi e-mail s odkazem na vytvoření hesla?");'> <form method=POST class='btn-group' onsubmit='return confirm("Poslat organizátorovi e-mail s odkazem na vytvoření hesla?");'>
{{ resend_invite_form.csrf_token }} {{ resend_invite_form.csrf_token }}
<button class="btn btn-default" type='submit' name='resend_invite'> <button class="btn btn-default" type='submit' name='resend_invite' value='yes'>
{% if user.last_login_at %}Resetovat heslo{% else %}Znovu poslat zvací e-mail{% endif %} {% if user.last_login_at %}Resetovat heslo{% else %}Znovu poslat zvací e-mail{% endif %}
</button> </button>
</form> </form>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
{% if resend_invite_form %} {% if resend_invite_form %}
<form method=POST class='btn-group' onsubmit='return confirm("Poslat účastníkovi e-mail s odkazem na vytvoření hesla?");'> <form method=POST class='btn-group' onsubmit='return confirm("Poslat účastníkovi e-mail s odkazem na vytvoření hesla?");'>
{{ resend_invite_form.csrf_token }} {{ resend_invite_form.csrf_token }}
<button class="btn btn-default" type='submit' name='resend_invite'> <button class="btn btn-default" type='submit' name='resend_invite' value='yes'>
{% if user.last_login_at %}Resetovat heslo{% else %}Znovu poslat zvací e-mail{% endif %} {% if user.last_login_at %}Resetovat heslo{% else %}Znovu poslat zvací e-mail{% endif %}
</button> </button>
</form> </form>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment