auth2_fc: set novalidate on unlink cancel button (#39445)

This commit is contained in:
Benjamin Dauvergne 2020-01-31 12:05:48 +01:00
parent f03e3aae66
commit 64abfdca0c
2 changed files with 10 additions and 1 deletions

View File

@ -28,6 +28,6 @@
{% csrf_token %}
{{ form.as_p }}
<input type="submit" name="unlink" value="{% trans "Unlink" %}"/>
<input type="submit" name="cancel" value="{% trans "Cancel" %}"/>
<input type="submit" name="cancel" formnovalidate value="{% trans "Cancel" %}"/>
</form>
{% endblock %}

View File

@ -148,6 +148,15 @@ def test_login_simple(app, fc_settings, caplog, hooks, exp):
# we must be connected
assert app.session['_auth_user_id']
assert models.FcAccount.objects.count() == 1
# test unlink cancel case
response = app.get('/accounts/')
response = response.click('Delete link')
assert len(response.pyquery('[name=cancel][formnovalidate]')) == 1
response = response.form.submit(name='cancel')
response = response.follow()
# test unlink submit case
response = app.get('/accounts/')
response = response.click('Delete link')
response.form.set('new_password1', 'ikKL1234')