W
Wasp•6mo ago
fred-123

What are the password requirements for users?

I have noticed that non safe passwords can't be used. What are the specific requirements for the passwords?
2 Replies
kapa.ai
kapa.ai•6mo ago
Hi @fred-123. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- In Wasp, when using the default authentication flow, there are certain default validations that are applied to the user's password. These validations are: - The password must not be empty. - The password must have at least 8 characters. - The password must contain a number. These validations are applied if you use Wasp's built-in Auth UI or if you use the provided auth actions. If you decide to create your custom auth actions, you'll need to run the validations yourself. Here is an example of how these validations are implemented in the middleware:
const defaultValidations = [
{ name: 'password must be present', fn: data => !!data.password },
{ name: 'password must be at least 8 characters', fn: data => data.password.length >= 8 },
{ name: 'password must contain a number', fn: data => /\d/.test(data.password) },
]
const defaultValidations = [
{ name: 'password must be present', fn: data => !!data.password },
{ name: 'password must be at least 8 characters', fn: data => data.password.length >= 8 },
{ name: 'password must contain a number', fn: data => /\d/.test(data.password) },
]
For each validation, if the validation function returns false, an EntityValidationError is thrown with the name of the validation that failed. You can find more information about this in the Wasp documentation (https://wasp-lang.dev/docs/auth/overview#default-validations) and in the Github issue (https://github.com/wasp-lang/wasp/issues/88) where this was discussed. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @fred-123, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
miho
miho•6mo ago
The bot gave the correct answer 🙂
Want results from more Discord servers?
Add your server