how to use one's login page for multiple modules

I have two different module in an application

  • user
  • admin

They have mutual User table with different role assigned

and they have separate login screens in their modules

What I want is to have only one login page when user login with admin credentials it redirect them to admin homepage and if user is normal user it should redirect them to user homepage

both homepages present in different modules for example admin homepage present in admin module and user homepage present in user module

So If I Click on publish button in admin module it is opening first admin login page I want logic for redirecting users according to their role if an user try to login should go to user homepage and if an admin try to login he should go on admin homepage

please help me with this how can I achieve this, provide logic also if possible for the login button to redirect user according to their role

Hi Darshan,

A pattern that's commonly used is having a Login Block on the Theme layer, that you can consume on the UI layer. So you'll have all the login logic inside the block, and on your UI modules, you just have a screen with a placeholder, consume the block, and put it there.

Hope this helps!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.