js-validationform/src/passwordValidation.js

12 lines
No EOL
370 B
JavaScript

// password validation
export function passwordValidation (origPassword) {
// check if passwords match
if (this.value === origPassword) {
this.setCustomValidity('');
this.reportValidity();
return;
}
// otherwise highlight and pop up message
this.setCustomValidity("Please ensure passwords match");
this.reportValidity();
}