Typecho 前台注册增加密码项

发布时间:2021-03-31

众所周知 Typecho注册只需要填写账号及邮箱

如何实现注册设置密码 下面开始进入设置

进入/admin/Register.php

添加:

<p>
<label for="password" class="sr-only"><?php _e('密码'); ?></label>
<input type="password" id="password" name="password" placeholder="<?php _e('密码'); ?>" value="<?php echo $rememberPassword; ?>" class="text-l w-100" autofocus />
</p>
<p>
<label for="confirm" class="sr-only"><?php _e('重复密码'); ?></label>
<input type="password" id="confirm" name="confirm" placeholder="<?php _e('重复密码'); ?>" value=" 
<?php echo $rememberConfirm; ?>" class="text-l w-100" />
</p>

在 /var/Widget/Register.php 文件中,找到:

$generatedPassword = Typecho_Common::randString(7);

改成:

/** 如果请求中含有password则设置为密码,否则随机密码 */
if (array_key_exists('password', $_REQUEST)) {
$generatedPassword = $this->request->password;
}
else
{
$generatedPassword = Typecho_Common::randString(7);
}

打赏


哇 你要支持我吗?太慷慨了!谢谢
上一篇
下一篇