password and confirm password validation in node.js code example
Example 1: password and confirm password validation js
var check = function() {
if (document.getElementById('password').value ==
document.getElementById('confirm_password').value) {
document.getElementById('message').style.color = 'green';
document.getElementById('message').innerHTML = 'matching';
} else {
document.getElementById('message').style.color = 'red';
document.getElementById('message').innerHTML = 'not matching';
}
}
Example 2: validate password in nodejs
npm i joi-password-complexity
const passwordComplexity = require("joi-password-complexity");
const complexityOptions = {min: ,max: ,lowercase: ,
uppercase: , numeric: ,symbol: , requirementCount: };
-> passwordComplexity().validate("<your_password>");
or
-> passwordComplexity(complexityOptions).validate("<your_password>");