Best answer

Create new user Wordpress password field, how to generate random password?

  • 5 May 2021
  • 6 replies
  • 2466 views

Hi,

 

I am trying to set up a zap with the action to create a new user in WordPress (Trigger: new Typeform). However, it requires me to fill in a password, which means every new user through this zap will have the same password. This is of course not something you want and highly insecure. Is there a way to let it auto generate a password, which will be send to the newly created user afterwards? 

If not, this zap seems not to be an option in any case, or an I missing something?

Thanks in advance!

 

Cheers,

Niels

icon

Best answer by GetUWired 5 May 2021, 15:15

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

6 replies

Userlevel 7
Badge +10

@NielsGeo 

As a workaround, you can add a “Formatter → Number - Spreadsheet Formula” step, then add the fowlling:

RANDBATWEEN(1000000,9999999)

This will output a random 7-digit number you could use as the password.

It’s not really that secure from a security standpoint, but better than the same password for everyone.

If possible, I’d try and make it so the user is forced to reset their password the first time they login.

Userlevel 7
Badge +12

@NielsGeo 

A more secure password could easily be generate with a javascript code block (Code by Zapier) using the following script. Essentially, length is the length you want the new password to be and the charset variable is all the characters that could be included in the password.  it uses random numbers to decide which characters get selected and then creates a password the length you specify. 

function generatePassword() {
//the length of the password
var length = 12,
//the character set to choose from
charset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!&$@*^",
retVal = "";
for (var i = 0, n = charset.length; i < length; ++i) {
retVal += charset.charAt(Math.floor(Math.random() * n));
}
return retVal;
}

let password = generatePassword();

return {password}

 

@GetUWired Hey! Sorry for my late reply. This works great to generate a random password.

However, I am still having trouble setting this up, as the password field of the “Create user in WordPress” Zap is a field I have to type something in, so I can’t use the function you provided in that field. Do you know how to tackle this?

Thanks so much for your help!

 

 

Userlevel 7
Badge +12

Hi @NielsGeo 

You might have to map the “pill” manually. Click the eyeball for viewing purposes and then dynamically pass in the value should be something like {{123179576__password}} but the numeric in front is the node id of the code step. Here is an article on that 

 

 

Alternatively, map the password to another field then use keyboard shortcuts to copy and paste the value into the password field during set up.

Userlevel 1

This was helpful to a point but password fields won’t allow input. The pill mapping would only place the {{…..}} literal in the field. Suggestions?

Userlevel 7
Badge +12

Hi @Sixlevel 

That is incorrect. While it may appear that the input is just the literal {{...}} Zapier will process that the same as any other input field. See below with a test app I built out. 

In the screenshots below, the pill for column phone from the previous step is shown in the url and mapped to the password field.

In the next shot, you can see the input field types and the code that zapier will run