用户注册页面自定义密码功能!!!!
发表于 : 2018年 1月 8日 10:09
默认的注册页面只有用户名 邮箱,密码是系统生成的,进入后台弹出提示注册者。
。。。。。。。这也太扯了。
怎么实现在注册页面就让用户填写密码。。。。
看了一下注册相关源码。。好像密码项目也是预设了的,不知道怎么弄。。
。。。。。。。这也太扯了。
怎么实现在注册页面就让用户填写密码。。。。
看了一下注册相关源码。。好像密码项目也是预设了的,不知道怎么弄。。
ClayMore 写了:有编码能力可以自己弄 没的话只能找外援
代码: 全选
/** 如果请求中有password */
if (array_key_exists('password', $_REQUEST)) {
$validator->addRule('password', 'required', _t('必须填写密码'));
$validator->addRule('password', 'minLength', _t('为了保证账户安全, 请输入至少六位的密码'), 6);
$validator->addRule('password', 'maxLength', _t('为了便于记忆, 密码长度请不要超过十八位'), 18);
$validator->addRule('confirm', 'confirm', _t('两次输入的密码不一致'), 'password');
}
代码: 全选
$generatedPassword = Typecho_Common::randString(7);
代码: 全选
$this->widget('Widget_Notice')->set(_t('用户 <strong>%s</strong> 已经成功注册, 密码为 <strong>%s</strong>', $this->screenName, $generatedPassword), 'success');
代码: 全选
<p>
<label for="name" class="sr-only"><?php _e('用户名'); ?></label>
<input type="text" id="name" name="name" placeholder="<?php _e('用户名'); ?>" value="<?php echo $rememberName; ?>" class="text-l w-100" autofocus />
</p>
<p>
<label for="mail" class="sr-only"><?php _e('Email'); ?></label>
<input type="email" id="mail" name="mail" placeholder="<?php _e('Email'); ?>" value="<?php echo $rememberMail; ?>" class="text-l w-100" />
</p>
代码: 全选
<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>
代码: 全选
$dataStruct = array(
'name' => $this->request->name,
'mail' => $this->request->mail,
'screenName'=> $this->request->name,
'password' => $hasher->HashPassword($generatedPassword),
'created' => $this->options->time,
'group' => 'subscriber'
);
代码: 全选
$generatedPassword = Typecho_Common::randString(7);
代码: 全选
/** 如果请求中含有password则设置为密码,否则随机密码 */
if (array_key_exists('password', $_REQUEST)) {
$generatedPassword = $this->request->password;
}
else
{
$generatedPassword = Typecho_Common::randString(7);
}