Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Resources/config/listeners.xml
  • Loading branch information
core23 committed Jan 11, 2020
2 parents 888ae28 + db8ff44 commit c31703c
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 65 deletions.
27 changes: 23 additions & 4 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Installation
1. Download NucleosProfileBundle using composer
2. Enable the Bundle
3. Configure the NucleosProfileBundle
4. Import NucleosProfileBundle routing
4. Configure your application's security.yaml
5. Import NucleosProfileBundle routing

Step 1: Download NucleosProfileBundle using composer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -65,8 +66,26 @@ Add the following configuration to your ``config/packages/nucleos_profile.yaml``
from_email: "%mailer_user%"
Step 4: Import NucleosProfileBundle routing files
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Step 4: Configure your application's security.yaml
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In addition to the NucleosUserBundle configuration, you have to define some new access rules.

Below is a minimal example of the configuration necessary to use the NucleosUserBundle
in your application:

.. code-block:: yaml
# config/packages/security.yaml
security:
// ...
access_control:
- { path: ^/profile, role: IS_AUTHENTICATED_REMEMBERED }
Step 5: Import NucleosProfileBundle routing files
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Now that you have activated and configured the bundle, all that is left to do is
import the NucleosProfileBundle routing files.
Expand All @@ -78,7 +97,7 @@ logging in, creating users, etc.
# config/routes/nucleos_profile.yaml
nucleos_profile:
resource: "@NucleosProfileBundle/src/Resources/config/routing/all.xml"
resource: "@NucleosProfileBundle/Resources/config/routing/all.xml"
.. _Symfony documentation: https://symfony.com/doc/current/book/translation.html
.. _NucleosUserBundle documentation: https://nucleosuserbundle.readthedocs.io
4 changes: 3 additions & 1 deletion src/Form/Type/ProfileFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
->add('locale', LocaleType::class, [
'label' => 'form.locale',
'translation_domain' => 'NucleosProfileBundle',
'required' => false,
])
->add('timezone', TimezoneType::class, [
'label' => 'form.locale',
'label' => 'form.timezone',
'translation_domain' => 'NucleosProfileBundle',
'required' => false,
])
;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/listeners.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<service id="Nucleos\ProfileBundle\EventListener\AuthenticationListener">
<tag name="kernel.event_subscriber"/>
<argument type="service" id="nucleos_user.security.login_manager"/>
<argument>%nucleos_profile.firewall_name%</argument>
<argument>%nucleos_user.firewall_name%</argument>
</service>
<service id="Nucleos\ProfileBundle\EventListener\AlreadyLoggedinListener">
<tag name="kernel.event_subscriber"/>
Expand Down
49 changes: 0 additions & 49 deletions src/Resources/config/validation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,54 +51,5 @@
</property>
</class>
<class name="Nucleos\ProfileBundle\Form\Model\Profile">
<property name="username">
<constraint name="NotBlank">
<option name="message">nucleos_user.username.blank</option>
<option name="groups"/>
</constraint>
<constraint name="Length">
<option name="min">2</option>
<option name="minMessage">nucleos_user.username.short</option>
<option name="max">180</option>
<option name="maxMessage">nucleos_user.username.long</option>
<option name="groups"/>
</constraint>
</property>
<property name="email">
<constraint name="NotBlank">
<option name="message">nucleos_user.email.blank</option>
<option name="groups"/>
</constraint>
<constraint name="Length">
<option name="min">2</option>
<option name="minMessage">nucleos_user.email.short</option>
<option name="max">180</option>
<option name="maxMessage">nucleos_user.email.long</option>
<option name="groups">
</option>
</constraint>
<constraint name="Email">
<option name="message">nucleos_user.email.invalid</option>
<option name="groups"/>
</constraint>
</property>
<property name="plainPassword">
<constraint name="NotBlank">
<option name="message">nucleos_user.password.blank</option>
<option name="groups">
<value>ResetPassword</value>
<value>ChangePassword</value>
</option>
</constraint>
<constraint name="Length">
<option name="min">8</option>
<option name="max">4096</option>
<option name="minMessage">nucleos_user.password.short</option>
<option name="groups">
<value>ResetPassword</value>
<value>ChangePassword</value>
</option>
</constraint>
</property>
</class>
</constraint-mapping>
2 changes: 2 additions & 0 deletions src/Resources/translations/NucleosProfileBundle.de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ form:
password_confirmation: 'Passwort bestätigen'
new_password: 'Neues Passwort'
new_password_confirmation: 'Neues Passwort bestätigen'
timezone: 'Zeitzone'
locale: 'Sprache'
2 changes: 2 additions & 0 deletions src/Resources/translations/NucleosProfileBundle.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ form:
password_confirmation: 'Repeat password'
new_password: 'New password'
new_password_confirmation: 'Repeat new password'
timezone: 'Timezone'
locale: 'Locale'
4 changes: 2 additions & 2 deletions src/Resources/views/Profile/edit.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "@NucleosProfile/layout.html.twig" %}

{% block nucleos_profile_content %}
{% block nucleos_user_content %}
{% include "@NucleosProfile/Profile/edit_content.html.twig" %}
{% endblock nucleos_profile_content %}
{% endblock nucleos_user_content %}
4 changes: 2 additions & 2 deletions src/Resources/views/Profile/show.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "@NucleosProfile/layout.html.twig" %}

{% block nucleos_profile_content %}
{% block nucleos_user_content %}
{% include "@NucleosProfile/Profile/show_content.html.twig" %}
{% endblock nucleos_profile_content %}
{% endblock nucleos_user_content %}
4 changes: 2 additions & 2 deletions src/Resources/views/Registration/check_email.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

{% trans_default_domain 'NucleosProfileBundle' %}

{% block nucleos_profile_content %}
{% block nucleos_user_content %}
<p>{{ 'registration.check_email'|trans({'%email%': user.email}) }}</p>
{% endblock nucleos_profile_content %}
{% endblock nucleos_user_content %}
4 changes: 2 additions & 2 deletions src/Resources/views/Registration/confirmed.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

{% trans_default_domain 'NucleosProfileBundle' %}

{% block nucleos_profile_content %}
{% block nucleos_user_content %}
<p>{{ 'registration.confirmed'|trans({'%username%': user.username}) }}</p>
{% if targetUrl %}
<p><a href="{{ targetUrl }}">{{ 'registration.back'|trans }}</a></p>
{% endif %}
{% endblock nucleos_profile_content %}
{% endblock nucleos_user_content %}
4 changes: 2 additions & 2 deletions src/Resources/views/Registration/register.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "@NucleosProfile/layout.html.twig" %}

{% block nucleos_profile_content %}
{% block nucleos_user_content %}
{% include "@NucleosProfile/Registration/register_content.html.twig" %}
{% endblock nucleos_profile_content %}
{% endblock nucleos_user_content %}

0 comments on commit c31703c

Please sign in to comment.