1.0.0 • Published 7 years ago

try-react-password-input v1.0.0

Weekly downloads
3
License
ISC
Repository
github
Last release
7 years ago

try-react-password-input

npm version

A password input component which accepts certain qualifications for password to valid as props and then returns whether password is valid or in the callback

For validations we have used password-validator module

Installation

npm install try-react-password-input

How to use it ?

import Password from 'try-react-password-input';

handleChange(passwordValid, password) {
  console.log(passwordValid, password);
}

<Password
  uppercase
  lowercase
  digits
  onChange={this.handleChange}
  className="password-input"
/>

Password Validations available pas props

ValidationtypeDescription
uppercaseBooleanspecifies whether password should contain uppercase characters
lowercaseBooleanspecifies whether password should contain lowercase characters
digitsBooleanspecifies that password should contain digits
noSpacesBooleanspecifies that password should not contain any spaces
maxNumberspecifies the maximum number characters in password no max chars in password, unless specified
minNumberspecifies the minimum number characters in password no min chars in password, unless specified
symbolsBooleanspecifies whether or not password should contain symbols

Note: All the above props/validation if Boolean has default value as false, and others are undefined.

Other Props

PropTypeDefaultDescription
valueStringempty stringvalue of password text
onChangeFunctionempty funtionmethod called everytime value is changed in password input field, has passwordValidity and password value in arguments (if list is true, receives array of keys as list invalidities which are spelled same as props)
listBooleanTruespecifies whether validation api should return list of failed validations or not
showValidityBooleanTruespecifies if the validity indicator needs to be shown to indicate password is valid or not (list showing all the validities if list is true else and small indicator showing password valid or not)
showPasswordBooleanFalsespecifies whether show password button needs to be shown or not
classNameStringempty stringadds class to the root element
inputClassStringempty stringadds class to the input element

Note : All the other default props such as id, etc. are accpted by default if they are not one of the props listed above such as onChange.