Closed gezquinndesign closed 3 years ago
I posted a related question in the spectrum chat forum
Yeah spectrum is not working well, I am not checking it anymore and there is no way to make it only read-only :(
To answer your question you can use the validateNewUser
option of the password package for this https://www.accountsjs.com/docs/api/password/globals/#validatenewuser.
Hi @pradel,
I think spectrum is becoming read-only in August 2021 anyway.
Maybe you can use github discussions instead and keep it localised with the package? react-hook-form manages it well.
Thanks for the suggestion. Can I also use that to ensure users added via oauth have a username?
The github discussions tab in the repository is already enabled 👍 The docs should be updated to reflect the change.
For Oauth this is not possible at the moment, happy to merge a pr adding support for it :)
Cool. If you could change the link here under "Ask a question" as well that would be good.
I'll have a look to see if I can create a PR.
@pradel could you give me a high-level description of what you consider would be required in a PR that adds validateNewUser support for oauth - I'm struggling to see the wood for the trees.
I think there are 2 ways of doing this, we could add a new hook or use an option similar to what is done for the password package.
You can look at the implementation done for password in packages/password/src/accounts-password.ts
.
It might be easier to do it via an option as it will impact only the OAuth package that way. The documentation is here https://www.accountsjs.com/docs/strategies/password/#extend-the-user-and-validate-custom-fields
What do you think?
Upon further inspection, I've decided it's not worth adding a new option. I can achieve the same result by accessing the user in the getRegistrationPayload
method of the oauth class and doing my validation there, so I'm going to close this ticket for now. Thanks for your help.
Feature request
Is your feature request related to a problem? Please describe.
I have a requirement that when users are added to my system that they should have usernames defined. At the moment, I ensure the username is defined client-side. I posted a related question in the spectrum chat forum but didn't get a response, hence why I'm posting here.
Describe the solution you'd like
Similar to the ValidateLogin Server hook, I would like a similar one for ValidateCreateUser to ensure additional checks regarding the user can be made before accounts-js creates the user.