[SOLVED] Simple frontend users, redirects and privileges

Hello,

I need to have a simple front-end user system. Using the role Flowpack.Neos.FrontendLogin:User seems enough for now, but how can I control the user redirection after login ? Right now, when I login with a front-end user I am getting a 403 error because by default it’s trying to access the back-end. I don’t need access to the back-end for now, so ideally I’d want to redirect the user to the members area after login.

Also, how do I make a custom logout button ? Since the front-end user can’t access the backend, I don’t know how to log out.

Finally, how can I increase the login timeout period ? The default period seems to be short. Maybe there is a documentation for advanced login configuration somewhere ?

Thanks in advance !

Hi George,

did you have a look at the Neos demo site? It comes with a FE Login example including redirect to a member area and logout.

By default authentication is done with a session cookie, so its valid as long as the browser session. You could change the default session cookie lifetime in your configuration but you can’t increase the time extending the browser session…

To use a different mechanism you can implement/use a custom AuthenticationProvider. For example one that is based on a JWT stored in a persistent cookie.

Hello @bwaidelich,

do you mean the en/features/frontend-user-login.html page in the demo site ? If I’m not mistaken that login form is just dummy, at least I don’t see any difference after using member:password credentials, neither can I use those in the /neos login form.

I have the Demo site installed locally for experimenting, could you point me to which file I should look ?

Oh boy are you mistaken :wink:

In the installed demo site it should state

If you installed the demo site yourself, you can create a Frontend User via the command:
./flow user:create --authentication-provider “Flowpack.Neos.FrontendLogin:Frontend” --roles “Flowpack.Neos.FrontendLogin:User”

If you execute that on the CLI you can specify username, password, first and last name of a new FE user record to be created.
After that you can log in and should see

where the login form was before.

And in the Backend you can select the FE Form plugin and specify redirects:

Oh man, I thought member:password came as a default user upon installation. Thanks for your tips, I’ll take a look into it !

1 Like

Something’s weird, logging in with that form through my frontend user doesn’t change something, I’ll create a new demo installation, maybe I messed something up while testing.

Hmmm, I think I know what’s wrong.

If I create the user through the backend (with User role), the form doesn’t recognize him, but the command does the trick. However, I want to be able to add users through the backend, why is it failing ? Is it because you can’t specify an Authentication provider in the backend ? I can probably configure that in the code though, I’ll take a look, thanks !

UPDATE: Ah right, the backend assigns “Neos Backend” as the authentication provider

UPDATE2: Alright got it, I just have to pick the correct authentication provider when creating the user. Question: Is it possible to map an authentication provider based on the user role when the “system default” authentication is picked ?