Hi.
I have a scenario with a “Create a user” module from WordPress.
Although it’s not common, sometimes the password doesn’t meet all the requirements set by WordPress, the module generates an error, and the user isn’t created.
How can I make the module repeat until the password is valid and the user is created correctly?
Thanks.
Hey there,
where are you taking the password from? Repeating the module it self wont work here, you need to restart the flow from the point where the password is getting generated.
Hi
The password is generated within the module itself using formulas that select random characters from uppercase letters, lowercase letters, numbers, and special characters.
Almost always, a valid password is generated, and the user is created without issue. However, occasionally a number or a special character is missing, for example, and then user creation fails because the password is invalid.
If this module could be repeated, statistically, a valid password should be generated on the next attempt.
Ok, in that case just add a Break error handler and it will retry the module.
Also here is a formula that will give you one uppercase letter, one lowercase letter, one number and one special symbol guaranteed in a 16 symbol password:
{{join(shuffle(add(emptyarray; first(shuffle(split("ABCDEFGHIJKLMNOPQRSTUVWXYZ"; ""))); first(shuffle(split("abcdefghijklmnopqrstuvwxyz"; ""))); ceil(random * 10); first(shuffle(split("!@#$%^&*"; ""))); first(shuffle(split("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; ""))); first(shuffle(split("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; ""))); first(shuffle(split("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; ""))); first(shuffle(split("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; ""))); first(shuffle(split("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; ""))); first(shuffle(split("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; ""))); first(shuffle(split("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; ""))); first(shuffle(split("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; ""))); first(shuffle(split("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; ""))); first(shuffle(split("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; ""))); first(shuffle(split("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; ""))); first(shuffle(split("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; ""))))); emptystring)}}
I usually use a variation of this though since its easier to manage and modify as needed.