Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support easier insertion of required data during account creation #73

Open
evadecker opened this issue Sep 18, 2024 · 1 comment
Open

Comments

@evadecker
Copy link

evadecker commented Sep 18, 2024

I've run into an issue that could benefit from some better DX. (Originally posted on Discord)

I'm adding roles to my user table, and I'd like to make the "role" column required. When a user signs up, they'll be given the "user" role by default.

Following the docs, I can insert data using afterUserCreatedOrUpdated() pretty easily, but it only works if "role" is v.optional(). That's not the worst, but I'd prefer to make it required.

I could use createOrUpdateUser() to insert the data before creation, but I need to rewrite a bunch of boilerplate logic that the library is already providing just to add one extra field.

It'd be awesome to be able to hook into different points in the user creation flow while still relying on the default creation logic where it doesn't need changing.

Thanks for creating Convex Auth, really enjoying it!

@dowski
Copy link
Collaborator

dowski commented Oct 23, 2024

From reading your Discord messages, it sounds like this won't directly help, but if you're using password authentication you can customize what gets populated into the users table:

https://labs.convex.dev/auth/config/passwords#customize-user-information

Do note that up through version 0.0.73, if you customize profile with the Password provider, you need to do any password validation that you require in profile as well. In subsequent versions, password validation will be controlled separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants