diff --git a/README.md b/README.md
index c73ba54..25d30b0 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,8 @@ for instructions on how to set the following configurations:
* templatePackage
Hint: to override the sender address for this package, you will need the following setting:
-```YAML
+
+```yaml
Sandstorm:
TemplateMailer:
senderAddresses:
@@ -66,7 +67,8 @@ If you can't remove them, just include the subroutes for this package manually b
your packages, which allows you to override config and will make sure authorizations work correctly. Keep in mind that you have to add this into all
packages that use features from user management - very important if your site is split into multiple packages or plugins.
Here's an example:
-```
+
+```json
{
"description": "Your Site Package",
"type": "neos-site", (or "neos-package" if you're using Flow only or building a Plugin)
@@ -84,7 +86,8 @@ Here's an example:
## Basic configuration options
These are the basic configuration options for e-mails, timeouts etc. You will usually want to adapt these to your application.
-```
+
+```yaml
Sandstorm:
UserManagement:
# Validity timespan for the activation token for newly registered users.
@@ -107,7 +110,8 @@ Sandstorm:
### I18N
It is possible to use i18n for the messages configured in the settings. Simply by setting the values to 'i18n'.
-```
+
+```yaml
Sandstorm:
UserManagement:
authFailedMessage:
@@ -120,7 +124,8 @@ Sandstorm:
## Additional Settings for usage in Neos
You should switch the implementation of the Redirect and User Creation Services to the Neos services. Add this to your `Objects.yaml`:
-```
+
+```yaml
# Use the Neos services
Sandstorm\UserManagement\Domain\Service\RedirectTargetServiceInterface:
className: 'Sandstorm\UserManagement\Domain\Service\Neos\NeosRedirectTargetService'
@@ -136,7 +141,7 @@ as it's in the templates of this package.
Add the following to your package's (or the global) `Settings.yaml`. This creates a separate authentication provider so Neos can
distinguish between frontend and backend logins.
-```
+```yaml
Neos:
Flow:
security:
@@ -169,7 +174,9 @@ with `Typo3BackendProvider` in the config above.
### Creating users
The package exposes a command to create users. You can run
-`./flow sandstormuser:create test@example.com password --additionalAttributes="firstName:Max;lastName:Mustermann"`
+```bash
+./flow sandstormuser:create test@example.com password --additionalAttributes="firstName:Max;lastName:Mustermann"
+```
to create a user. This will create a Neos user if you're using the package in Neos. You can assign
roles to the new user in the Neos backend afterwards.
@@ -177,12 +184,16 @@ roles to the new user in the Neos backend afterwards.
### Confirming user registration
It is possible to confirm a registrationflow and trigger user creation by running
-`./flow sandstormuser:activateregistration test@example.com`
+```bash
+./flow sandstormuser:activateregistration test@example.com
+```
### Resetting passwords
Since 1.1.2, it is possible to reset passwords for users created with this package.
-`./flow sandstormuser:setpassword test@example.com password`
+```bash
+./flow sandstormuser:setpassword test@example.com password
+```
If the package detects that the NeosUserCreationService is used, it forwards the command to the
Neos `UserCommandController->setPasswordCommand()`. Otherwise, our oackage's own logic is used.
@@ -190,12 +201,15 @@ Neos `UserCommandController->setPasswordCommand()`. Otherwise, our oackage's own
The Authentication Provider can be passed in as an optional argument to reset passwords for users created
with a different provider that the default UserManagement one (`Sandstorm.UserManagement:Login`):
-`./flow sandstormuser:setpassword test@example.com password --authenticationProvider=Typo3BackendProvider`
+```bash
+./flow sandstormuser:setpassword test@example.com password --authenticationProvider=Typo3BackendProvider
+```
## Redirect after login/logout
### Via configuration
To define where users should be redirected after they log in or out, you can set some config options:
-```
+
+```yaml
Sandstorm:
UserManagement:
redirect:
@@ -216,6 +230,7 @@ The pages you link here will be shown after users log in or out. Please note tha
on a restricted page: in that case you MUST set a redirect target, otherwise you will receive an error message on logout.
If the redirection is configured via Settings.yaml, they will take precedence over the configuration at the node.
You can, of course, set these properties from TypoScript also if you have a login/logout form directly in you template:
+
```
loginform = Sandstorm.UserManagement:LoginForm {
// This should be set, or there will be problems when you have multiple plugins on a page
@@ -229,7 +244,8 @@ loginform = Sandstorm.UserManagement:LoginForm {
If redirecting to a specific controller method is still not enough for you, you can simply roll your own implementation of the
`RedirectTargetServiceInterface`. Just add the implementation within your own package and add the following lines to your `Objects.yaml`.
Mind the package loading order, you package should require sandstorm/usermanagement in its composer.json.
-```
+
+```yaml
Sandstorm\UserManagement\Domain\Service\RedirectTargetServiceInterface:
className: 'Your\Package\Domain\Service\YourCustomRedirectTargetService'
```
@@ -237,7 +253,7 @@ Sandstorm\UserManagement\Domain\Service\RedirectTargetServiceInterface:
## Checking for a logged-in user in your templates
There is a ViewHelper available that allows you to check if somebody is logged into the frontend. Here's an example:
-```
+```html
{namespace um=Sandstorm\UserManagement\ViewHelpers}
@@ -248,7 +264,6 @@ There is a ViewHelper available that allows you to check if somebody is logged i
You are not logged in!
-
```
If you have configured a different Authentication Provider than the default one, the viewhelper has an `authenticationProviderName`
@@ -261,7 +276,7 @@ You can change any template via the default method using `Views.yaml`. Please se
http://flowframework.readthedocs.io/en/stable/TheDefinitiveGuide/PartIII/ModelViewController.html#configuring-views-through-views-yaml.
Here's an example how to plug your own login template:
-```YAML
+```yaml
-
requestFilter: 'mainRequest.isPackage("Neos.Neos") && isPackage("Sandstorm.UserManagement") && isController("Login") && isAction("login")'
@@ -282,7 +297,8 @@ You might want to add additional information to the user model. This can be done
the User model delivered with this package and adding properties as you like. You will then
need to switch out the implementation of `UserCreationServiceInterface` to get control over
the creation process. This can be done via `Objects.yaml`:
-```YAML
+
+```yaml
Sandstorm\UserManagement\Domain\Service\UserCreationServiceInterface:
className: 'Your\Package\Domain\Service\YourCustomUserCreationService'
```
@@ -292,7 +308,8 @@ The UserManagement package emits three signals during the login and logout proce
using Flows [Signals and Slots](http://flowframework.readthedocs.io/en/stable/TheDefinitiveGuide/PartIII/SignalsAndSlots.html)
mechanism. You could for example use this to set additional cookies when a user logs in, e.g. to enable JWT authentication
with another service. Here is an example of using all three, you could copy this into your own `Package.php` file:
-```PHP
+
+```php
public function boot(Bootstrap $bootstrap) {
$dispatcher = $bootstrap->getSignalSlotDispatcher();
$dispatcher->connect(
@@ -311,7 +328,8 @@ public function boot(Bootstrap $bootstrap) {
```
Your example service could then look like this:
-```PHP
+
+```php
namespace Your\Package\Domain\Service;
use Neos\Flow\Mvc\ActionRequest;
@@ -343,7 +361,8 @@ It has a few default properties and can be extended with arbitrary additional da
### Adding custom fields to the Registration Flow
Exchange the registration template as described above and add a field:
-```HTML
+
+```html
```
This will add the field, but of course you might also want to validate it.
@@ -353,7 +372,8 @@ The UserManagement package has a hook for you to implement your custom registrat
called directly from the domain model validator of the package. All you need to to is create an implementation of
`Sandstorm\UserManagement\Domain\Service\RegistrationFlowValidationServiceInterface` in your own package. It could
look like this:
-```PHP
+
+```php
class RegistrationFlowValidationService implements RegistrationFlowValidationServiceInterface {
/**
* @param RegistrationFlow $registrationFlow
@@ -371,7 +391,10 @@ class RegistrationFlowValidationService implements RegistrationFlowValidationSer
# 4. Running Tests
Run all tests with:
-`./bin/phpunit -c ./Build/BuildEssentials/PhpUnit/UnitTests.xml Packages/Application/Sandstorm.UserManagement/Tests/Unit`
+
+```bash
+./bin/phpunit -c ./Build/BuildEssentials/PhpUnit/UnitTests.xml Packages/Application/Sandstorm.UserManagement/Tests/Unit
+```
# 5. Known issues