[wp-trac] [WordPress Trac] #9210: random password generator [editing users page]
WordPress Trac
wp-trac at lists.automattic.com
Sun Feb 14 03:19:37 UTC 2010
#9210: random password generator [editing users page]
----------------------------+-----------------------------------------------
Reporter: jdingman | Type: enhancement
Status: new | Priority: normal
Milestone: Future Release | Component: Users
Version: | Severity: normal
Keywords: needs-patch |
----------------------------+-----------------------------------------------
Comment(by sivel):
Simply because I don't want to lose this code again, here is a javascript
version of wp_generate_password:
{{{
var wp_generate_password = function(length, special_chars) {
length = ( typeof length == 'undefined' ) ? 12 : length;
special_chars = ( typeof special_chars == 'undefined' ) ? true :
special_chars;
chars =
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
if ( special_chars )
chars = chars + '!@#$%^&*()';
password = '';
for ( i = 0; i < length; i++ ) {
start = Math.floor(Math.random()*chars.length);
password = password + chars.substring(start - 1, start);
}
return password;
}
}}}
I figure this could be of use for this ticket.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/9210#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list