Assigning role to user on signup
![Trent Jackson](https://us.v-cdn.net/6037124/user_avatars/5613121.jpg)
The user selects who they are on first screen (coach, parent or athlete) then they are taken to that role's sign-in/sign up screen.
Any suggestions?
Comments
-
another small question, can I have user authentication using a username rather than an email? I have younger users and would like to not have to store their emails.
-
Hi Trent
I achieved that goal of assigning users a role in my site using Memberstack. people sign up with a default role (visitor) and then may optionally select a different role (artist or nonprofit).
Memberstack offers the ability to restrict access to a defined set of pages or in my case I restricted access to a subdomain for the latter two.
With respect to the email question - who is to say what fake domain is "ok" as long as it does not expose kids to abuse but still maintains a means of authentication. Like "trent1234@email.com"
That might be a proxy within your site or just a way to identify a user with well understood practices and form.
Regards
David Richardson -
Hey I would make sure to have a role field defined in your user database. You probably want to use an Enum for this value since there are 3 possible values. Pass the value of the role they select on the first page and use it as an input for your sign up endpoint to add to the database.
Yes, you can fully customize all your endpoints so if you decide to authenticate with a username over an email. -
Hi @Michael Udinski,
Hope it's ok I'm replying to this response as I have more than 1 user too. From what I understand I will create one user table and have a enum list field for the types of users. Then on the signup page I can ask the users to tick which type of user they are which will them be added to the database.
I am unsure of this part: "Pass the value of the role they select on the first page ". Can you explain what this means? I want to make sure I'm not missing any steps.
I'm also wondering if database wise if it is better to have 2 separate tables ( 1 for each user) than one table for both. What are the pros and cons ( if you have a video about it I can watch that). I have watched Prakash's and your videos about databases many times but still unsure.
Thanks so much.
-
Hi @Mimi -
"Pass the value of the role they select on the first page ". Can you explain what this means? I want to make sure I'm not missing any steps.
This was in regard to Trent's specific use-case flow, where is sign up process is multiple pages. In this case, front-ends typically can pass data from page to page so he could retain his role value until he's ready to submit all his data. This could also be accomplished with editing the record each step (page) too.
I would recommend 1 table for all your users. Xano allows you to separate data pretty easily
-
Hi @Michael Udinski,
Ahh ok, thanks for explaining that.
Ok, I will keep the users all on one table.
Thanks so much.
-
Hello 🙋♀️
Is it possible to know how you solved the problem of separating users with separate roles?
Additionally, can new registrations be automatically assigned to the appropriate role's schedule? -
Hi @Hanan Radwan take a look at our documentation and tutorial on implementing role-based access control to separate users with separate roles:
https://docs.xano.com/building-features/role-based-access
Registrations can automatically be assigned to the appropriate role in the /signup API endpoint. You'll want to create additional logic to assign the user a role based on whatever parameters matter. If you have more specific details on what those look like I can try to better articulate that for your use case
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback