Random New User Password Generator for WordPress
Inspired by https://wordpress.org/extend/ideas/topic/random-password-for-new-users WordPress plugin idea, and a bit of time on my hands, I decided to code up a simple little plugin that is easy to understand and use.
Meet the Random New User Passwords for WordPress plugin. It’s a minimum viable solution, with zero-configuration, so don’t expect much.
Plugin approval status: approved and ready for download.
How it works
The plugin enqueues its script and stylesheet on the wp-admin/user-new.php page. A convenient filter that can be hooked to output error messages is
show_password_fields. Although filters should not have side-effect, big no-no, I have chosen to break the rule.
show_password_fields is hooked by some plugin or theme that disables the password fields. In the future, Random New User Password will probably use this hook to provide deeper features.
The pseudo-random password generator is simple as well (should have called the plugin Simple Random New User Password instead), with the current character set of a-Z0-9, which is enough in most cases it generates a, what appears to be, random string, which is fed into the password fields thereafter.
The plugin is l10n-ready, with just 3 strings to translate.
What should the next steps be?
- Where are the settings? Password length, character set, prefix.
- Generate temporary passwords to force users to change once they’re in (hopefully not to 12345678 or password)
- More buttons and sexier name!
Let me know what you think; is it useful? Are you using it? Would you like to contribute some ideas or maybe code? Feel free to issue pull requests to the plugin on github; will add you to contributors in SVN once we get approved in the WordPress.org repo.
Turns out there’s been something similar already: Simple User Password Generator… is there any plugin that hasn’t been coded yet? 🙂
P.S. Props to @1Popol for the random dice icon.