@beinformed/ui 1.18.7 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/esm/hooks/useNotification.js +11 -1
- package/esm/hooks/useNotification.js.map +1 -1
- package/esm/models/attributes/AttributeModel.js +5 -2
- package/esm/models/attributes/AttributeModel.js.map +1 -1
- package/esm/models/attributes/PasswordAttributeModel.js +47 -27
- package/esm/models/attributes/PasswordAttributeModel.js.map +1 -1
- package/lib/hooks/useNotification.js +15 -1
- package/lib/hooks/useNotification.js.flow +20 -1
- package/lib/hooks/useNotification.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js +3 -1
- package/lib/models/attributes/AttributeModel.js.flow +20 -16
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/PasswordAttributeModel.js +47 -27
- package/lib/models/attributes/PasswordAttributeModel.js.flow +56 -41
- package/lib/models/attributes/PasswordAttributeModel.js.map +1 -1
- package/package.json +15 -15
- package/src/hooks/useNotification.js +20 -1
- package/src/models/attributes/AttributeModel.js +20 -16
- package/src/models/attributes/PasswordAttributeModel.js +56 -41
|
@@ -93,52 +93,67 @@ export default class PasswordAttributeModel extends StringAttributeModel {
|
|
|
93
93
|
* Add password constraints
|
|
94
94
|
*/
|
|
95
95
|
addConstraints(): ConstraintCollection {
|
|
96
|
+
if (this.isConfirmPassword) {
|
|
97
|
+
return this.getConfirmPasswordConstraints();
|
|
98
|
+
}
|
|
99
|
+
return this.getStandardPasswordConstraints();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Constraints for a confirmation password
|
|
104
|
+
*/
|
|
105
|
+
getConfirmPasswordConstraints(): ConstraintCollection {
|
|
96
106
|
const constraints = new ConstraintCollection();
|
|
107
|
+
constraints.add(
|
|
108
|
+
new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)
|
|
109
|
+
);
|
|
110
|
+
return constraints;
|
|
111
|
+
}
|
|
97
112
|
|
|
98
|
-
|
|
113
|
+
/**
|
|
114
|
+
* Constrains for a standard password
|
|
115
|
+
*/
|
|
116
|
+
getStandardPasswordConstraints(): ConstraintCollection {
|
|
117
|
+
const constraints = new ConstraintCollection();
|
|
118
|
+
|
|
119
|
+
if (this.upperAndLowerCaseMandatory) {
|
|
120
|
+
constraints.add(new PasswordLowerAndUpperCaseConstraint());
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (this.maxSequenceOfIdenticalCharacters) {
|
|
124
|
+
constraints.add(
|
|
125
|
+
new PasswordThreeConsecutiveCharactersNotAllowedConstraint(
|
|
126
|
+
this.maxSequenceOfIdenticalCharacters
|
|
127
|
+
)
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (this.minNumberOfNumericCharacters) {
|
|
132
|
+
constraints.add(
|
|
133
|
+
new PasswordMinNumericCharactersConstraint(
|
|
134
|
+
this.minNumberOfNumericCharacters
|
|
135
|
+
)
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (this.minNumberOfSpecialCharacters) {
|
|
140
|
+
constraints.add(
|
|
141
|
+
new PasswordMinSpecialCharactersConstraint(
|
|
142
|
+
this.minNumberOfSpecialCharacters
|
|
143
|
+
)
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (this.regexConstraints && this.regexConstraints.length > 0) {
|
|
148
|
+
this.regexConstraints.forEach((regexConstraint) => {
|
|
149
|
+
constraints.add(new RegexConstraint(regexConstraint));
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (this.layouthint.has(CONFIRM_PASSWORD) && this.confirmValue !== "") {
|
|
99
154
|
constraints.add(
|
|
100
155
|
new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)
|
|
101
156
|
);
|
|
102
|
-
} else {
|
|
103
|
-
if (this.upperAndLowerCaseMandatory) {
|
|
104
|
-
constraints.add(new PasswordLowerAndUpperCaseConstraint());
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (this.maxSequenceOfIdenticalCharacters) {
|
|
108
|
-
constraints.add(
|
|
109
|
-
new PasswordThreeConsecutiveCharactersNotAllowedConstraint(
|
|
110
|
-
this.maxSequenceOfIdenticalCharacters
|
|
111
|
-
)
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (this.minNumberOfNumericCharacters) {
|
|
116
|
-
constraints.add(
|
|
117
|
-
new PasswordMinNumericCharactersConstraint(
|
|
118
|
-
this.minNumberOfNumericCharacters
|
|
119
|
-
)
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (this.minNumberOfSpecialCharacters) {
|
|
124
|
-
constraints.add(
|
|
125
|
-
new PasswordMinSpecialCharactersConstraint(
|
|
126
|
-
this.minNumberOfSpecialCharacters
|
|
127
|
-
)
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (this.regexConstraints && this.regexConstraints.length > 0) {
|
|
132
|
-
this.regexConstraints.forEach((regexConstraint) => {
|
|
133
|
-
constraints.add(new RegexConstraint(regexConstraint));
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (this.layouthint.has(CONFIRM_PASSWORD)) {
|
|
138
|
-
constraints.add(
|
|
139
|
-
new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
157
|
}
|
|
143
158
|
|
|
144
159
|
return constraints;
|