Mike_SA
191
6
Laravel

Keep current user logged in when creating a new user in admin

Posted 2 months ago by Mike_SA

Hi,

I have built a users area in my CMS and I am experiencing an issue when a new user is created.

I am using Laravel 5.7.25. The CMS does not allow users to be created by anyone that is not logged in and does not have full admin rights.

I am using the standard " register " shipped with Laravel (app\http\auth\RegisterController). The only difference is that the middleware is set to 'admin'.

When I create a new user , the new users is created but it logs out the current user and logs the new user in.

How do I prevent this. I would like the current user to remain logged in.

I have tried things that only lead to the registercontroller breaking and throwing errors:

https://laraveldaily.com/register-without-login/ https://laravel.io/forum/i-want-the-registercontroller-class-to-prevent-automatic-login-after-registration

Thank you in advance

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.