You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 23, 2023. It is now read-only.
React-Nice-Input-Password uses the traditional input[type=password] behinde the cenes, but you can now validate the strenght level of this value and show it to your users.
38
-
39
-
The strenght can be passed as a `array` of `objects` to a prop of the component called `securityLevels`.
33
+
React-Nice-Input-Password uses the traditional input[type=password] behinde the cenes.
34
+
The strenght configuration can be passed as an `array` of `objects` to the prop `securityLevels`.
40
35
41
36
You can see a sample of code bellow:
42
37
@@ -51,7 +46,6 @@ class App extends React.Component {
51
46
this.setState({
52
47
[data.name]:data.value,
53
48
});
54
-
console.log(`Value: ${passwordField.value}`);
55
49
}
56
50
render() {
57
51
const { passwordField } =this.state;
@@ -63,18 +57,18 @@ class App extends React.Component {
63
57
name="passwordField"
64
58
value={value}
65
59
securityLevels={[
66
-
{
67
-
descriptionLabel:'At least 1 number',
68
-
validator:/.*[0-9].*/,
69
-
},
70
-
{
71
-
descriptionLabel:'At least 1 letter',
72
-
validator:/.*[a-zA-Z].*/,
73
-
},
74
-
{
75
-
descriptionLabel:'At least 1 uppercase letter',
76
-
validator:/.*[A-Z].*/,
77
-
},
60
+
{
61
+
descriptionLabel:'1 number',
62
+
validator:/.*[0-9].*/,
63
+
},
64
+
{
65
+
descriptionLabel:'1 lowercase letter',
66
+
validator:/.*[a-z].*/,
67
+
},
68
+
{
69
+
descriptionLabel:'1 uppercase letter',
70
+
validator:/.*[A-Z].*/,
71
+
},
78
72
]}
79
73
showSecurityLevelBar
80
74
showSecurityLevelDescription
@@ -85,6 +79,60 @@ class App extends React.Component {
You can provide a custom `className` to the Nice Input Password and custom `className` to the color levels, which will be added to input, description and bullets level elements using `dangerClassName`, `warningClassName` and `successClassName`.
0 commit comments