1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > PHPCMS整合UCENTER后登陆问题

PHPCMS整合UCENTER后登陆问题

时间:2019-07-06 17:47:06

相关推荐

PHPCMS整合UCENTER后登陆问题

独角兽企业重金招聘Python工程师标准>>>

PHPCMS整合UCENTER后我们会经常有修改用户密码问题,你会发现如果在Ucenter中直接修改密码后,PHPCMS用新密码无法登陆了。其实这是因为密码没同步的原因,下面讲解下登陆流程:

登陆会调用module/member/index.php的login方法

如果开启了PHPSSO,则会调用$status = $this->client->ps_member_login($username, $password);

ps_member_login这个方法在 module/member/class/client.class.php中

这个方法会调用$this->_ps_send('login', array('username'=>$username, 'password'=>$password));

private function _ps_send($action, $data = null) {

return $this->_ps_post($this->ps_api_url."/index.php?m=phpsso&c=index&a=".$action, 500000, $this->auth_data($data));

}

通过这个方法可以看出这个方法会通过phpsso_server/index.php/phpsso/index.php文件LOGIN方法来判断登陆情况。现在就有几种情况,

首先这个方法会通过list($uid, $uc['username'], $uc['password'], $uc['email']) = uc_user_login($this->username, $this->password, 0);获取$uid,于此同时会查询pre_phpsso_member表中的userinfo记录。

1、如果userinfo有记录并且开启了uc于此同时uid没有则代表,ucenter中没有数据,则用用户密码密码注册一遍。于此同时将ucuerid更新到 pre_phpsso_member表中

2、如果userinfo没记录并且开启了uc于此同时uid有记录,则表示在ucenter注册了,但在phpsso没注册,则往 pre_phpsso_member中插入数据。

3、如果 userinfo没记录并且开启了uc于此同时uid没记录,则直接exit(-1),用户不存在了

4、如果userinfo没记录并且没开启uc直接 exit(-1),用户不存在了

现在到了最后一步,也是前面说的为什么在ucenter中修改密码后会提示密码错误了

if(!empty($userinfo) && $userinfo['password'] == create_password($this->password, $userinfo['random'])) {

//登录成功更新用户最近登录时间和ip

$this->db->update(array('lastdate'=>SYS_TIME, 'lastip'=>ip()), array('uid'=>$userinfo['uid']));

exit(serialize($userinfo));

} else {

exit('-2');

}

大家可以看到这一步会将pre_phpsso_member中的密码跟传递过来的密码进行校对,也就是说如果登陆时输入的密码如果跟pre_phpsso_member不一致,哪怕ucenter校验通过了,这里依然会报告密码错误但是ucenter会正常登陆。

总结:由以上可知,我们在做大型门户的经常会碰到多系统的问题,一般情况下会整合UCENTER,挂N个系统,论坛,百科,新闻系统,人才系统……,二三十个系统也可能不在话下,这个时候我们会经常发现用户名虽然同意了,但是密码是没统一的情况,

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。