I would like to make a suggestion to add a button in user form that generates random password and if it is a new user registration, the a email is sent to the new registered user with login details.
of course developers can achieve this but may on updates , it will disappear.
below function iam using at the moment where the length of password can be defined. It will be easy when creating a number of users and not have to think of any random password.
This just my though and suggestion towards improvement of NB.
Code: Select all
function GenerateRandomPassword(length) {
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+~|}{[]?><,./-=';
var password = '';
for (var i = 0; i < length; i++) {
var randomIndex = Math.floor(Math.random() * characters.length);
password += characters.charAt(randomIndex);
}
return password;
}
// Example usage:
//var randomPassword = generateRandomPassword(15);
console.log(randomPassword);
Nilesh