原因,phpcms的bug,傳輸userid失敗導(dǎo)致的。
原來的代碼如下
/*
* 測試郵件配置
*/
public function send_newmail() {
$_username = param::get_cookie('_regusername');
$_userid = param::get_cookie('_reguserid');
$_ssouid = param::get_cookie('_reguseruid');
$newemail = $_GET['newemail'];
if($newemail==''){//郵箱為空,直接返回錯誤
return '2';
}
$this->_init_phpsso();
$status = $this->client->ps_checkemail($newemail);
if($status=='-5'){//郵箱被占用
exit('-1');
}
if ($status==-1) {
$status = $this->client->ps_get_member_info($newemail, 3);
if($status) {
$status = unserialize($status); //接口返回序列化,進(jìn)行判斷
if (!isset($status['uid']) || $status['uid'] != intval($_ssouid)) {
exit('-1');
}
} else {
exit('-1');
}
}
//驗證郵箱格式
pc_base::load_sys_func('mail');
$phpcms_auth_key = md5(pc_base::load_config('system', 'auth_key'));
$code = sys_auth($userid.'|'.SYS_TIME, 'ENCODE', $phpcms_auth_key);
$url = APP_PATH."index.php?m=member&c=index&a=register&code=$code&verify=1";
//讀取配置獲取驗證信息
$member_setting = getcache('member_setting');
$message = $member_setting['registerverifymessage'];
$message = str_replace(array('{click}','{url}','{username}','{email}','{password}'), array('<a href="'.$url.'">'.L('please_click').'</a>',$url,$_username,$newemail,$password), $message);
if(sendmail($newemail, L('reg_verify_email'), $message)){
//更新新的郵箱,用來驗證
$this->db->update(array('email'=>$newemail), array('userid'=>$_userid));
$this->client->ps_member_edit($_username, $newemail, '', '', $_ssouid);
$return = '1';
}else{
$return = '2';
}
echo $return;
}
修改后的如下:
/*
* 測試郵件配置
*/
public function send_newmail() {
$_username = param::get_cookie('_regusername');
$_userid = param::get_cookie('_reguserid');
$_ssouid = param::get_cookie('_reguseruid');
$newemail = $_GET['newemail'];
if($newemail==''){//郵箱為空,直接返回錯誤
return '2';
}
$this->_init_phpsso();
$status = $this->client->ps_checkemail($newemail);
if($status=='-5'){//郵箱被占用
exit('-1');
}
if ($status==-1) {
$status = $this->client->ps_get_member_info($newemail, 3);
if($status) {
$status = unserialize($status); //接口返回序列化,進(jìn)行判斷
if (!isset($status['uid']) || $status['uid'] != intval($_ssouid)) {
exit('-1');
}
} else {
exit('-1');
}
}
//驗證郵箱格式
pc_base::load_sys_func('mail');
$phpcms_auth_key = md5(pc_base::load_config('system', 'auth_key'));
$code = sys_auth($_userid.'|'.SYS_TIME, 'ENCODE', $phpcms_auth_key);
$url = APP_PATH."index.php?m=member&c=index&a=register&code=$code&verify=1";
//讀取配置獲取驗證信息
$member_setting = getcache('member_setting');
$message = $member_setting['registerverifymessage'];
$message = str_replace(array('{click}','{url}','{username}','{email}','{password}'), array('<a
href="'.$url.'">'.L('please_click').'</a>',$url,$_username,$newemail,$password), $message);
if(sendmail($newemail, L('reg_verify_email'), $message)){
//更新新的郵箱,用來驗證
$this->db->update(array('email'=>$newemail), array('userid'=>$_userid));
$this->client->ps_member_edit($_username, $newemail, '', '', $_ssouid);
$return = '1';
}else{
$return = '2';
}
echo $return;
}
ID傳輸失敗就自然不知道是認(rèn)證誰了,所以導(dǎo)致的老用戶傳輸ID失敗不能郵箱認(rèn)證。
|
新聞熱點(diǎn)
疑難解答
圖片精選