Skip to content

Commit

Permalink
Fix/minor translation and style fixes (#6)
Browse files Browse the repository at this point in the history
* fix trust device FIELD_TRUST_DEVICE checkbox optional (if empty there was a php error)

* minor translation & visual fixes. Use zed gui layout when 2FA is enforced and user has to setup (instead of layout-plain). Add css class to
  • Loading branch information
victor-ufg authored Jan 16, 2023
1 parent 55026cf commit b04576b
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function indexAction(Request $request)
if ($isAuthenticated) {
$redirectResponse = $this->redirectResponse($this->getFactory()->getConfig()->getHomePath());

if ($formData[AuthenticationForm::FIELD_TRUST_DEVICE]) {
if ($formData[AuthenticationForm::FIELD_TRUST_DEVICE]?? false) {
$trustedDeviceCookie = Uuid::uuid1()->toString();
$this->getFacade()->trustDevice($trustedDeviceCookie);
$redirectResponse->headers->setCookie(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

{% block content %}

<div>
<div class="second-factor-auth">
{{ form_start(form) }}

{% include '@SecurityGui/Partial/form-message.twig' %}

<p>
{{ 'You are using second factor authentication. User your mobile application and enter the code into the field below.' | trans }}
{{ 'You are using second factor authentication. Use your mobile application and enter the code into the field below.' | trans }}
</p>

{{ form_errors(form) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{% block text_widget %}
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-terminal fa-inverse"></i></span>
<span class="input-group-addon"><i class="fa fa-terminal"></i></span>
{{ block('form_widget_simple') }}
</div>
</div>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{% form_theme form '@SecondFactorAuth/Layout/form.twig' %}


{% if status != 'registered' and is_required %}
{% include '@SecondFactorAuth/Registration/partials/required.twig' %}
{% else %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
{% endif %}

<div class="second-factor-device-list">
<b>{{ 'Install one of these applications for 2FA: ' | trans }}</b><a target="_blank" href="https://authy.com/">Authy</a> (preferred) | <a target="_blank" href="https://support.google.com/accounts/answer/1066447">Google Authenticator</a>
<b>{{ 'Install one of these applications for 2FA:' | trans }}</b> <a target="_blank" href="https://authy.com/">Authy</a> (preferred) | <a target="_blank" href="https://support.google.com/accounts/answer/1066447">Google Authenticator</a>
</div>

<div class="row">
Expand All @@ -41,7 +41,7 @@
<img src={{ qr_code_url }}>
</p>
<p>
<div>Alternatively you can enter the code manually: <b>{{ secret }}</b></div>
<div>{{ 'Alternatively you can enter the code manually:' | trans }} <b>{{ secret }}</b></div>
</p>

</div>
Expand All @@ -50,7 +50,7 @@
<div class="form-group">
<button class="btn btn-success btn-block btn-outline btn" type="submit">
{% if status == 'registered' %}
{{ 'Unegister' | trans }}
{{ 'Unregister' | trans }}
{% else %}
{{ 'Register' | trans }}
{% endif %}
Expand Down Expand Up @@ -79,7 +79,7 @@
<div class="form-group">
<button class="btn btn-success btn-block btn-outline btn" type="submit">
{% if status == 'registered' %}
{{ 'Unegister' | trans }}
{{ 'Unregister' | trans }}
{% else %}
{{ 'Register' | trans }}
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends '@SecondFactorAuth/Layout/layout-plain.twig' %}
{% extends '@Gui/Layout/layout.twig' %}

{% set widget_title = 'Two Factor Authentication' %}

Expand All @@ -22,4 +22,4 @@

{% endembed %}

{% endblock %}
{% endblock %}

0 comments on commit b04576b

Please sign in to comment.