User and admin login

Hello, I was wondering if someone can help. We have set up a page with two buttons one leads to a “client login” page and the other links to an “admin login” page. The admin login goes to a list of all current and past clients and the client login goes to their tip information. The issue we are facing is that a client can log in as a admin and vise versa, I have set up two true/false properties in the users database - one is “admin?” Set to true on the admin users and one called “Clients?” This is set to true on the client users. These are both set to false for the opposite, so the admin is set for true in “admin?” And false in “client?” But we are still facing the issue that the client can login as a admin if they go to the admin login page.

I would like the clients to be redirected to the client login page when they try and login as an admin.

Hi @rachael,

Couple of thoughts:

  • I wonder why you’ve decided to introduce 2 properties, from my point of view 1 (IsAdmin) would be enough
  • Is it absolutely necessary to have 2 different login screens? Possible way to set it up is to have one login screen, then put an “interim” blank screen, on which you add the logic: upon screen enter, you add a conditional action of redirect to Admin console screen, and this action happens only if IsAdmin=True. And you add a second action to redirect to Client screen.
  • If you absolutely need 2 separate login screens, you could add an interim screen after admin login screen, where you check if user is admin, and if not - log him/her out and redirect to client login screen. Not sure this conditionals will work on login screen itself, that’s why interim screen might be needed.

Please note, that if this is a webapp, you will need to implement extra security measures on each admin screen (user check and may be display content conditionally), to protect the webapp against unauthorised access via copying URL.

Hi, thanks for answering. we only set up 2 login screens as we didn’t know how to separate the logins for the admins and for the clients. I’m not sure how to set up a Interim screen but this sounds like exactly what we need. do you know if there is a video? or anyone that could talk me though how to add this?

There is a video for company number logins. This shows the inter screen. This would give you a good starting place and probably get what you need. Check out the Adalo you tube channel

Hi @rachael,

Enjoy:

1 Like

Thank you for this. I was just bitching about their lack of tutorials on this. LOL. You’re a god send. I can’t thank you enough. Cheers!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.