Aerendir / bundle-users

A Symfony bundle that helps to manage users in your app

Home Page:https://io.serendipityhq.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make possible to use other unique fields of the user class to login

Aerendir opened this issue · comments

Use case

Often, the desired behaviour is to permit the login using the email or the nickname, indifferently.

Currently it is possible to login only using the primary field, set in security.[...].property.

Make possible to use other fields/properties to find the user.

Possible solution

When loading the user, fire an event LOAD_USER.

The implementing app can listen for this event and implement the custom logic required to load the user.

Once it is found, it sets it in the event.

The loader, then, returns the user from the event or, if no user is present in the event, continues to load the user using the logic already implemented (so, using the primary field).