How to create login pages for different roles

0
Hi everyone, I have a fitness application The first user that is using the app is an anonymous user and he has 2 buttons: Sign in as a Trainer or Sign in as a Client) When he clicks each button, he is redirected to login pages (login page for Trainer or login page for Client) and if he does not have an account, he can register as either a Trainer or a Client, because I linked each registration with an entity... I have 2 entities in Domain Model: Trainer and Client. My question is: How do I implement that on a particular login page, the login recognizes whether the user logging in is a Trainer or a Client and redirects them to their home page, which is different for both roles   In security I created 2 different roles and linked them to the entities, and in Navigation I used "Role-based homepages" but that doesnt seem to be enough. I am really new in Mendix and I really cant find any tutorial that handles this kind of login and registration on the internet, so I am pretty much in the dark on how to do this... Any kind of help is welcome!!! Below are screenshots that might be helpful to understand my problem: 1. Registration microflow for Client: 2. Registration microflow for Trainer: 3. Domain model:   4. Security: 5. Role-based homepages:
asked
3 answers
0

Hi Do─▒rijan 

 

Yo can  create a login page by following the steps as shown in the pictures below.

 

The first user will go to the page with the buttons anonymously. Then set which login page the button will go to.

 

But , as a more practical method, you can use one login page and  set the pages the user will go to according to their role after signing in, with a single login page. If the user has two roles, you can develop a scenario for which role he will continue with after logging in.

 

 you can develop a nanoflows scenario for the login button.

For example, if login is true and  if the user has one role, go to this page accordingly his role, if he has more than one role, go to a page where yhe user can make choices.

 

Add page.jpg

 

login.jpg

answered
0

Create nanoflows for the login button. A scenario similar to the one below. You need to configure it according to the structure of your project. This scenario improvisation example is to guide you. I haven't tested it :) You can do something similar, of course you can also implement it yourself in the easiest way.

 

login.jpg

answered
0

I tried that, but it always shows me the default homepage. 

I successfully register a user in a Trainer or Client entity, but when i try to log with a user it shows default homepage

 

Neautorizirani_korisnik means anonymous user

Treneri means Trainers

Klijenti means Clients

 

image.png

 

and here are my roles in security, i connected them to entities:

image.png

answered