用户自定义密码生成器

时间:2014-08-10 作者:a paid nerd

我正在使用WP-Members 允许新用户在我的网站上注册。在他们注册后,我检查他们的信息并激活他们,然后通过电子邮件向他们发送密码。

WordPress生成的密码相当复杂,例如:。v2Fj4S#b1Df(, 但我的用户年龄较大,我想给他们一些更难忘的密码,比如bucket382potato.

我可以重写WordPress中的本机密码生成器来提供我自己的密码方案吗?

1 个回复
SO网友:a paid nerd

我想出来了。我创建了一个插件,为random_password, 像这样:

function my_password_filter($input) {

    $words = explode(\' \', "apple arm banana bike bird book chin clam class clover club corn crayon crow crown crowd crib desk dime dirt dress fang field flag flower fog game heat hill home horn hose joke juice kite lake maid mask mice milk mint meal meat moon mother morning name nest nose pear pen pencil plant rain river road rock room rose seed shape shoe shop show sink snail snake snow soda sofa star step stew stove straw string summer swing table tank team tent test toes tree vest water wing winter woman women");

    $num = rand(100, 999);

    return $words[array_rand($words)] . $num . $words[array_rand($words)];

}

add_filter(\'random_password\', \'my_password_filter\', 10, 1);

结束