Download the PHP package sandstorm/usermanagement without Composer

On this page you can find all versions of the php package sandstorm/usermanagement. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package usermanagement

Sandstorm.UserManagement Neos / Flow Package

0. Features

This package works in Neos CMS and Flow and provides the following functionality:

1. Compatibility and Maintenance

Sandstorm.UserManagement is currently being maintained for the following versions:

Neos / Flow Version Sandstorm.UserManagement Version Branch Maintained
Neos 5.x-8.x, Flow 6.x-8.x 7.x master Yes
Neos 4.x, Flow 5.x 6.x 6.0 Yes
Neos 3.x, Flow 4.x 5.x 5.0 Bugfixes
Neos 2.3 LTS, Flow 3.3 LTS 3.x 3.0 No
Neos 2.2, Flow 3.2 1.x - No

Breaking changes in Version 5.x

Configuration Changes

Since I've removed the direct dependency to swiftmailer in favor of the Sandstorm/TemplateMailer package (which provides css inlining), the EmailService in this package was removed. This means that you will need to change some of your config options, because they are now set in the Sandstorm.TemplateMailer config path instead of inside the Sandstom.UserManagement path. Please refer to the Sandstorm/TemplateMailer Documentation for instructions on how to set the following configurations:

Hint: to override the sender address for this package, you will need the following setting:

Changes to Email Templates

In the registration email templates, two variables are no longer available by default:

To overwrite the existing Activation- and PasswordReset templates, do the following:

2. Configuration

Setup

There are the basic config steps:

  1. Run ./flow doctrine:migrate after you add this package to install its model. The package automatically exposes its routes via auto-inclusion in the package settings. Attention: Any routes defined in the global Routes.yaml are loaded before this package's routes, so they may be overriden. This is especially true for the default Flow subroutes, so make sure you have removed those from your global Routes.yaml. If you can't remove them, just include the subroutes for this package manually before the Flow subroutes.

  2. Require this package in your own package's composer.json. This will inform Flow that it needs to load UserManagement before 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:

  3. Run ./flow neos.flow:package:rescan to regenerate to order in which all your packages are loaded.

  4. Add and adapt the configuration settings below to your config (make sure to not miss the special Neos settings).

Basic configuration options

These are the basic configuration options for e-mails, timeouts etc. You will usually want to adapt these to your application.

I18N

It is possible to use i18n for the messages configured in the settings. Simply by setting the values to 'i18n'.

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:

Be aware that the NeosUserCreationService requires a non-empty firstName and lastName to be present in the RegistrationFlow attributes as it's in the templates of this package.

Neos 3.0 and higher

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.

Neos 2.3 (Flow 3.3)

Before Neos 3.0, the Neos.Neos:Backend authentication provider was called Typo3BackendProvider. Replace Neos.Neos:Backend with Typo3BackendProvider in the config above.

3. Usage

CLI Commands

Creating users

The package exposes a command to create users. You can run

./flow sandstormuser:create [email protected] 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.

Confirming user registration

It is possible to confirm a registrationflow and trigger user creation by running

./flow sandstormuser:activateregistration [email protected]

Resetting passwords

Since 1.1.2, it is possible to reset passwords for users created with this package.

./flow sandstormuser:setpassword [email protected] 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.

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 [email protected] 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:

Via node properties

When using the package within Neos, you have another possibility: you can set properties on the LoginForm node type. The pages you link here will be shown after users log in or out. Please note that when a login/logout form is displayed 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:

Via custom RedirectTargetService

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.

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:

If you have configured a different Authentication Provider than the default one, the viewhelper has an authenticationProviderName argument to which you can pass the name of the Auth Provider you are using.

Extending the package

Changing / overriding templates

You can change any template via the default method using Views.yaml. Please see 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:

Overriding e-mail templates

As documented in the configuration options above, overriding e-mail templates is easy:

Changing the User model

You might want to add additional information to the user model. This can be done by extending 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:

Hooking into the login/logout process

The UserManagement package emits three signals during the login and logout process, into which you can hook using Flows Signals and Slots 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:

Your example service could then look like this:

Changing the Registration Flow and validation logic

The RegistrationFlow class is the representation of a user signing up for your application. It has a few default properties and can be extended with arbitrary additional data via its attributes property.

Adding custom fields to the Registration Flow

Exchange the registration template as described above and add a field:

This will add the field, but of course you might also want to validate it.

Extending the Registration Flow validation logic

The UserManagement package has a hook for you to implement your custom registration flow validation logic. It is 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:

4. Running Tests

Run all tests with: ./bin/phpunit -c ./Build/BuildEssentials/PhpUnit/UnitTests.xml Packages/Application/Sandstorm.UserManagement/Tests/Unit

5. Known issues

Feel free to submit issues/PRs :)

6. TODOs

7. FAQ

8. License

MIT. https://opensource.org/licenses/MIT


All versions of usermanagement with dependencies

PHP Build Version
Package Version
Requires neos/flow Version ^6.0 || ^7.0 || ^8.0 || dev-master
sandstorm/templatemailer Version ^2.0.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sandstorm/usermanagement contains the following files

Loading the files please wait ....