Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace forms with a-href links #305

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/routes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ nelmio_security_report:

logout:
path: /logout
methods: [POST]
methods: [GET]
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
<h3>{{ 'ss.registration.vetting_type.title.self_vet'|trans }}</h3>
<hr>
<p>{{ 'ss.registration.vetting_type.description.self_vet'|trans }}</p>
<form action="{{ url('ss_second_factor_self_vet', {'secondFactorId': secondFactorId}) }}" method="get">
<a href="{{ url('ss_second_factor_self_vet', {'secondFactorId': secondFactorId}) }}">
<button type="submit" class="btn btn-primary">{{ 'ss.registration.vetting_type.button.self_vet'|trans }}</button>
</form>
</a>
</div>
</div>
{% endif %}
Expand All @@ -53,9 +53,9 @@
<h3>{{ 'ss.registration.vetting_type.title.self_asserted_tokens'|trans }}</h3>
<hr>
<p>{{ 'ss.registration.vetting_type.description.self_asserted_tokens'|trans }}</p>
<form action="{{ url('ss_second_factor_self_asserted_tokens', {'secondFactorId': secondFactorId}) }}" method="get">
<a href="{{ url('ss_second_factor_self_asserted_tokens', {'secondFactorId': secondFactorId}) }}">
<button type="submit" class="btn btn-primary">{{ 'ss.registration.vetting_type.button.self_asserted_tokens'|trans }}</button>
</form>
</a>
</div>
</div>
{% endif %}
Expand All @@ -66,9 +66,9 @@
<h3>{{ 'ss.registration.vetting_type.title.ra_vetting'|trans }}</h3>
<hr>
<p>{{ 'ss.registration.vetting_type.description.ra_vetting'|trans }}</p>
<form action="{{ url('ss_registration_send_registration_email', {'secondFactorId': secondFactorId}) }}" method="get">
<a href="{{ url('ss_registration_send_registration_email', {'secondFactorId': secondFactorId}) }}">
<button type="submit" class="btn btn-primary">{{ 'ss.registration.vetting_type.button.ra_vetting'|trans }}</button>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This construction is not 100% yet from a html structure point of view.

I'd say: remove the <button> element but keep the button text as the anchor text for the <a> element. And style the <a> to make it look like a button. I think we already have utility (css) classes ready for that.

Would you be so kind to look into that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I spent the entire afternoon but I can't get it to look visually the same without the button-tags. Leaving it 'as-is', but feel free to try it yourself

</form>
</a>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions templates/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
</div>
{% if app.user %}
<div class="clearfix page-header-user">
<form method="post" action="{{ logout_url('saml_based') }}" class="pull-right">
<a href="{{ logout_url('saml_based') }}" class="pull-right">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous feedback point.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will work because it changes the POST to a GET, and selfservice does not allow GET requests to the logout endpoint.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's cheating, because the GET-method was only removed two weeks ago ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite, in 4.0.9 (released Jun 6, 2023) I can also not use GET for logout, it only accepts POST.

<button type="submit" class="btn btn-link">
<i class="fa fa-sign-out"></i>
{{ 'button.logout'|trans }}
</button>
</form>
</a>
{% set locale_switcher = stepup_locale_switcher(app.request.locale, 'ss_switch_locale', {'return-url': app.request.uri}) %}
{{ form_start(locale_switcher, { attr: { class: 'form-inline' }}) }}
{{ form_widget(locale_switcher.locale) }}
Expand Down