ywana-core8 0.1.15 → 0.1.16
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/package.json
CHANGED
@@ -13,18 +13,20 @@ export const ResetPasswordBox = ({ logo, title, userRequired = true, oldPwdRequi
|
|
13
13
|
const [error, setError] = useState()
|
14
14
|
|
15
15
|
useEffect(() => {
|
16
|
-
|
16
|
+
const [valid, error] = validate()
|
17
|
+
setIsValid(valid)
|
18
|
+
setError(error)
|
17
19
|
}, [form.password1, form.password2, form.oldPassword])
|
18
20
|
|
19
21
|
function validate() {
|
20
22
|
const hasRequiredUser = userRequired ? form.user && form.user.length > 0 : true
|
21
23
|
const hasRequiredOldPwd = oldPwdRequired ? form.oldPassword && form.oldPassword.length > 0 : true
|
22
24
|
const hasPassword1 = form.password1 && form.password1.length > 0
|
23
|
-
|
24
|
-
|
25
|
+
let [isValid, error] = hasPassword1 ? validatePassword(form.password1) : [false, "La contraseña es requerida."]
|
26
|
+
|
25
27
|
const areEqual = form.password1 === form.password2
|
26
|
-
if (isValid && !areEqual)
|
27
|
-
return hasRequiredUser && hasRequiredOldPwd && areEqual && isValid
|
28
|
+
if (isValid && !areEqual) error = "Las contraseñas no coinciden."
|
29
|
+
return [hasRequiredUser && hasRequiredOldPwd && areEqual && isValid, error]
|
28
30
|
}
|
29
31
|
|
30
32
|
function changeField(id, value) {
|