RPV

Documentation

Simple and easy to use password validator for React

View examples
plyf?0d^_1dV2Z12g-=
Password is not empty
Password contains numbers
Min length 6 characters
Max length 20 characters
Special character
Contains lowercase letter
Contains capital letter
Passwords match
Not contains forbidden words

Get Started


To get started with RPV, install the dependency by running

Add RPV's styles into your App.css

Basic Usage


You can run the following example into your project

Available rules


RPV counts with the follwing rules to validate passwords

minLength

Verify if the provided password met the min length property

maxLength

Verify if the provided password met the max length property

specialChar

Verify if the password contains at least one special character

number

Verify if the password contains at least one number

capital

Verify if the password contains at least one capital letter

matches

Verify if the password matches with confirmedPassword value

lowercase

Verify if the password contains at least one lowercase letter

notEmpty

Verify if the password is not empty

shouldNotContain

Verify if the password contains forbidden words such as user’s name, lastname, etc…

Props


You can pass the follwing props

PropDescriptionTypeRequiredDefault
rulesRules that can be passed to check password strength. The rules that can be passed are minLength, maxLength, specialChar, number, capital, matches, lowercase, notEmpty, shouldNotContains<String>Arraytrue
minLengthMin length allowed for the passwordnumberfalse8
maxLengthMax length allowed for the passwordnumberfalse32
iconSizeSize of the iconsnumberfalse16
passwordPassword typed for the userstringtrue
confirmedPasswordPassword re-entered for the user. Required if matches option is passed into the rules arraystring
configConfiguration objectobjectfalse
onValidatorChangeFunction that will recieve the RPV statusfunctiontrue

Interfaces


You can pass the follwing props

IConfiguration

PropertyDescriptionTypeRequiredDefault
customTextUsed for multi languages porpusesICostumTextfalse
showProgressBarDisplay a progress bar, based on those rules that are being completedbooleanfalsefalse
showPasswordSuggestionEnables passwords suggestions for the user. User can generate different suggestions depending on their needs.booleanfalsefalse
classNamesLet the developer specify classes for different elements of RPVIClassNamesfalseundefined

ICustomText

PropertyDescriptionTypeRequiredDefault
minLengthCustomize error and success texts for minLength ruleIRuleCustomizetrueundefined
maxLengthCustomize error and success texts for maxLength ruleIRuleCustomizetrueundefined
specialCharCustomize error and success texts for specialChar ruleIRuleCustomizetrueundefined
numberCustomize error and success texts for number ruleIRuleCustomizetrueundefined
capitalCustomize error and success texts for capital ruleIRuleCustomizetrueundefined
matchesCustomize error and success texts for matches ruleIRuleCustomizetrueundefined
lowercaseCustomize error and success texts for lowercase ruleIRuleCustomizetrueundefined
notEmptyCustomize error and success texts for notEmpty ruleIRuleCustomizetrueundefined
shouldNotContainCustomize error and success texts for shouldNotContain ruleIRuleCustomizetrueundefined

IRuleCostumize

PropertyDescriptionTypeRequiredDefault
successTextMessage showed up when the password mets the rulestringtrueundefined
errorTextMessage showed up when the password doesn't met the rulestringtrueundefined

IClassNames

PropertyDescriptionTypeRequiredDefault
containerClassSpecified classes will be applied to RPV container element. Classes must be passed as a single string. i.e: my-class my-other-classstringtrueundefined
gridClassSpecified classes will be applied to RPV grid element. Classes must be passed as a single string. i.e: my-class my-other-classstringtrueundefined
ruleClassSpecified classes will be applied to RPV rule element, each rule element contains one rule inside. Classes must be passed as a single string. i.e: my-class my-other-classstringtrueundefined
validProgressBarClassSpecified classes will be applied to RPV valid progress bar element. Classes must be passed as a single string. i.e: my-class my-other-classstringtrueundefined
invalidProgressBarClassSpecified classes will be applied to RPV invalid progress bar element. Classes must be passed as a single string. i.e: my-class my-other-classstringtrueundefined

Advanced Usage


The following example is a complete configuration usage

Examples


Custom examples for RPV

Custom Progress Bar

The classes used for this example, are classes from TailwindCSS

Password is not empty
Min length 8 characters
Special character
Passwords match

With password suggestions and without progress bar

Password suggestions are based on maxLength prop. If you set maxLength to 16, password suggestion function, will suggest passwords of 16 -1 characters

2?2040(d)8]pdit
Password is not empty
Min length 8 characters
Special character
Contains lowercase letter
Passwords match
Password contains numbers

Example of dark mode

The classes used for this example, are classes from TailwindCSS

-0n]0<1z2p77(38
Password is not empty
Min length 8 characters
Special character
Contains lowercase letter
Passwords match
Password contains numbers

Support


You can also check:

If you are having troubles or want to discuss something else, feel free to let me know. Write at oscar.morales.developer@gmail.com