DEV Community

Discussion on: Password Creation in Svelte

Collapse
 
webjose profile image
José Pablo Ramírez Vargas

The individual check UI elements should be in their own component. Either make specialized components that know the rule to apply and then simply pass the password, or make a general component that receives either the validation function or the result of said validation function and then simply change in color.

Still, it is a nice UI for password setting.

Collapse
 
barim profile image
CodeCadim by Brahim Hamdouni

I'm not sure it's worth it to separate in individual components for each check for such a small piece of code : we loose the global readability of the rules to apply to the password.

Collapse
 
webjose profile image
José Pablo Ramírez Vargas

Separating them provides the ability to create different rules for different passwords. Most systems require only one password, but a few might require different passwords with different restrictions. Furthermore, if this ultimately were encapsulated in a library, for it to be the most effective cannot impose a fixed set of password rules. It needs to be versatile.

Thread Thread
 
barim profile image
CodeCadim by Brahim Hamdouni

totally agree for this contexts it makes sense :)