忘记密码错误 [英] Forgot Password Error

查看:123
本文介绍了忘记密码错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在代码点火器中使用tank auth作为登录处理程序。当我使用忘记密码功能时,我得到一个通过邮件发送的链接http://xx.xx.xx/en//auth/reset_password/2/01b951fd2a02efa2d64f1fe70c2a4e3b。当我点击此链接时,它总是说:您的激活密钥不正确或已过期。请再次检查您的电子邮件并按照说明操作。



i更改了细分,因此它获得正确的细分,但不知何故,如果( $ this-> form_validation-> run()),则会出错。它以某种方式想要new_password和confirm_new_password作为发布数据,但是从电子邮件中的链接中不会发送任何帖子数据。



这是坦克身份验证中的错误,是有一个quickfix(tank_auth会忘记一步,是不是配置好了吗?)



参考代码:

 function reset_password()
{
$ user_id = $ this-> uri-> segment(3);
$ new_pass_key = $ this-> uri-> segment(4);

$ this-> form_validation-> set_rules(' new_password'' 新密码'' < span class =code-string> trim | required | xss_clean | min_length ['。$ this-> config-> item(' < span class =code-string> password_min_length',' tank_auth')。< span class =code-string>' ] | max_length ['。$ this-> config-> item(' password_max_length'' tank_auth')。' ] | alpha_dash');
$ this-> form_validation-> set_rules(' confirm_new_password'' 确认新密码'' 修剪|所需| xss_clean |匹配[NEW_PASSWORD]');

$ data [' errors'] = array();

if ($ this-> form_validation-> run()){ // 验证确定
如果(!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');

// 使用新密码发送电子邮件
$ this- > _send_email(' reset_password',$ data [' email'],$ data);

$ this-> _show_message($ this-> lang-> line(' auth_message_new_password_activated'));
} 其他 {
// 失败
$ this-> _show_message($ this-> lang-> line(' auth_message_new_password_failed'));
}
} 其他 {
// 尝试通过密码密钥激活用户(如果尚未激活)
如果($ this-> config- > item(' email_activation'' tank_auth')){
$ this-> tank_auth-> activate_user($ user_id,$ new_pass_key,FALSE);
}
// TODO:
if (!$ this-> tank_auth-> can_reset_password($ user_id,$ new_pass_key)){
$ this-> _show_message($ this-> lang-> ; line(' auth_message_new_password_failed'));
}
}
$ data [' no_visible_elements'] =真正;
$ this-> load-> tile(' base'' auth / reset_password_form',$ data);
}

解决方案

this-> form_validation-> run())。它以某种方式想要new_password和confirm_new_password作为发布数据,但是从电子邮件中的链接中不会发送任何帖子数据。



这是坦克身份验证中的错误,是有一个quickfix(tank_auth会忘记一步,是不是配置好了吗?)



参考代码:

 function reset_password()
{


user_id =


这 - > URI->链段(3);


i use tank auth as login handler in code igniter. when i use the forget password feature, i get a link send by mail http://xx.xx.xx/en//auth/reset_password/2/01b951fd2a02efa2d64f1fe70c2a4e3b. When i click this link it always says: "Your activation key is incorrect or expired. Please check your email again and follow the instructions."

i changed the segments so it gets the right segments but somehow it the goes wrong on if ($this->form_validation->run()). it Somehow wants the new_password and confirm_new_password as post data but from the link in the email no post data will ofcourse be sent.

Is this a bug in tank auth, is there a quickfix (does tank_auth forget a step, is something not configured right?)

reference code:

function reset_password()
	{
		$user_id		= $this->uri->segment(3);
		$new_pass_key	= $this->uri->segment(4);

		$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()) {								// validation ok
			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'));
			} 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);
			}
//TODO:
			if (!$this->tank_auth->can_reset_password($user_id, $new_pass_key)) {
				$this->_show_message($this->lang->line('auth_message_new_password_failed'));
			}
		}
                 $data['no_visible_elements'] = true;
		$this->load->tile('base', 'auth/reset_password_form', $data);
	}

解决方案

this->form_validation->run()). it Somehow wants the new_password and confirm_new_password as post data but from the link in the email no post data will ofcourse be sent.

Is this a bug in tank auth, is there a quickfix (does tank_auth forget a step, is something not configured right?)

reference code:

function reset_password()
	{
		


user_id =


this->uri->segment(3);


这篇关于忘记密码错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆