Admin Module

0
Hi I’m using the 9.0.4 version and I’m developing a job searching app for two different user roles: applicant and recruiter. So I wanted to let anonymous users create an account before they start using the app, and then log in by using username and password. Then the system will show them the corresponding home page (applicant / recruiter) based on the user role they selected when they registered.  Basically, I used the Admin folder under User Management in Administration module from App Store modules. On Account_new page, the user needs to select user role between applicant or recruiter. How to let the users login and then show different home pages in SaveNewAccount microflow? Or is there a better way to solve this problem? Maybe in the navigation setting? Thank you!!!
asked
2 answers
1

First never put your own code in appstore modules. When you update the module you loose all your stuff. Put those custom made pages and microflows in your own module.

And indeed navigation is used for role based homepages. See documentation section 422 here: https://docs.mendix.com/refguide/navigation#1-introduction

Regards,

Ronald

 

answered
1

your approach is against all best practices. Never allow anonymous user to create directly an account. In order to achieve this, the anonymous user requires to much access rights and thus potentially manage other accounts.

A better approach is is to create an non-persistable entity, which captures all the details the app needs to create an Account. Create the account in a microflow based upon the details specified in the NPE. 

See this lecture: https://academy.mendix.com/link/module/325/lecture/2498/8.7.1-Creating-Accounts 

Also note that the anonymous user creating an account is actually loggedin to the app using a temporary account, which mendix manages. Thus this anonymous user != the account which is just created and thus the user must login using the NEW account, before the user will access the home page of the related role. As you modelled your microflow, the homepage of the anonymous user is displayed.

You need either to open a page with login widgets, to allow the user to login themselves or auto login them (which is a more complex trick; search on the forum, this has been answered many time already)

 

answered