1
我使用坦克auth作为代码点火器中的登录处理程序。当我使用忘记密码功能时,我通过邮件发送链接http://xx.xx.xx/en//auth/reset_password/2/01b951fd2a02efa2d64f1fe70c2a4e3b
。当我点击此链接时,它总是说:“您的激活密钥不正确或过期,请再次检查您的电子邮件并按照说明进行操作。”忘记密码tank_auth codeigniter
我改变了段,所以它得到正确的部分,但不知何故它出错if ($this->form_validation->run())
。它不知何故希望new_password
和confirm_new_password
作为发布数据,但从电子邮件中的链接不会发送任何发布数据。
这是在罐权威性的错误,有没有和quickfix(不tank_auth忘记了一步,没有配置正确的东西吗?)
参考代码:
function reset_password()
{
$break =$this->uri->total_segments();
$new_pass_key= $this->uri->segment($break);
$user_id= $this->uri->segment($break-1);
$this->form_validation->set_rules('new_password', 'New Password', 'trim|required|xss_clean|min_length['.$this->config->item('password_min_length', 'tank_auth').']|max_length['.$this->config->item('password_max_length', 'tank_auth').']|alpha_dash');
$this->form_validation->set_rules('confirm_new_password', 'Confirm new Password', 'trim|required|xss_clean|matches[new_password]');
$data['errors'] = array();
if ($this->form_validation->run()) { //breaks here. For some reason wants to validate post data which
if (!is_null($data = $this->tank_auth->reset_password($user_id, $new_pass_key,$this->form_validation->set_value('new_password')))) { // success
$data['site_name'] = $this->config->item('website_name', 'tank_auth');
// Send email with new password
$this->_send_email('reset_password', $data['email'], $data);
$this->_show_message($this->lang->line('auth_message_new_password_activated').' '.anchor('/auth/login/', 'Login'));
} else { // fail
$this->_show_message($this->lang->line('auth_message_new_password_failed'));
}
} else {
// Try to activate user by password key (if not activated yet)
if ($this->config->item('email_activation', 'tank_auth')) {
$this->tank_auth->activate_user($user_id, $new_pass_key, FALSE);
}
if (!$this->tank_auth->can_reset_password($user_id, $new_pass_key)) {
$this->_show_message($this->lang->line('auth_message_new_password_failed'));
}
}
$this->load->view('auth/reset_password_form', $data);
}
我添加了本地化,所以URL在默认情况下获得了'/ en /'。所以我改变了代码采取最后2个分区,这段代码工作正常 –
只需编辑它就像这样,看看我的编辑。 –
如果网址中有更多的细分受众群,这应该可以正常工作。 –