FredericHeem / starhackit

StarHackIt: React/Native/Node fullstack starter kit with authentication and authorisation, data backed by SQL, the infrastructure deployed with GruCloud
The Unlicense
1.28k stars 184 forks source link

same login page for both user & admin - combining now crashes system #557

Open bigbadbrad opened 4 years ago

bigbadbrad commented 4 years ago

Hi, I left this on another thread, but it was closed so don't know if you saw it. Thinking about this more you do want the Register/Signup/Create Account button on the login page for admin and user. I'm just trying to understand how you suggest using this app - does one sub-domain point to npm run start:admin and a different one to npm run start:user ?

Ideally your entire app would land you on a page which has a Register button, and a Login. Here's an example in genetic testing: https://secure.everlywell.com/login https://secure.everlywell.com/register Here's another where they are combined: https://my.teloyears.com

Register would only work for type=user (admin is hard-coded), and you register (create an account) using a Kit# printed on your sample collection kit, in genetics.

Login is for both users and admin (that's the case for the two companies mentioned above). And based on what "kind" of user was logging in - a general user or admin, you get routed to either /user/profile or /admin/user. I think I saw in the code "groups".

But right now, if you npm run start:admin, logout, and then login as a general user, alice, the system really crashes. If you routed the user as they logged in, based on type, then you wouldn't need multiple npm run starts - just one.

Just some thoughts...

FredericHeem commented 4 years ago

Can you please elaborate on "the system really crashes" ? Bear in mind that the login page is common for user and admin, but could be different in the future, the admin could force 2Fa for instance. The main goal here is to avoid separate git repo for user and admin frontend.

bigbadbrad commented 4 years ago

I log out of admin. Then login as alice. Then the screen goes crazy and flickers between this & that.

that this login_as_alice
FredericHeem commented 4 years ago

Thanks for the report, I'll investigate

bigbadbrad commented 4 years ago

Hmm I thought maybe it was because I didn't update the server. I just did that but now it doesn't return users. Something to do with groups.

Screen Shot 2020-08-14 at 11 55 16 AM
bigbadbrad commented 4 years ago

My bad - users didn't show up because I was still logged in as alice. Admin login works.