java整合discuz中,同步修改密碼的問題時候,discuz端發過來的密碼為空的問題:
現象:修改密碼時,UCenter通知其它應用的密碼為空。
解釋:UCenter原始程式在修改密碼時,其實并沒有對密碼進行同步傳遞,看uc_client源碼發現,Discuz! 接收的同步密碼也隻是随機生成的字元串。可能是為了安全或某種原因!
解決:對UCenter的伺服器端(uc_server)程式進行修改,添加密碼的同步通知!具體操作如下:
1、UCenter背景更改密碼後的通知程式:uc_server\control\admin\user.php,将其中的以下代碼:
$_ENV['note']->add('updatepw', 'username='.urlencode($username).'&password=');
修改為:
$_ENV['note']->add('updatepw', 'username='.urlencode($username).'&password='[b].$orgpassword[/b]);
2、UC通知程式:uc_server\control\user.php,将其中的以下代碼:
$_ENV['note']->add('updatepw', 'username='.urlencode($username).'&password=');
修改為:
$_ENV['note']->add('updatepw', 'username='.urlencode($username).'&password='[b].$newpw[/b]);
另外,如果是在應用裡修改密碼,而應用程式使用獨立使用者資料庫,則需要修改ucenter用戶端(uc_client)的相應代碼:
打開 uc_client\control\user.php 查找
$_ENV['note']->add('updatepw', 'username='.urlencode($username).'&password=');
修改為:
$_ENV['note']->add('updatepw', 'username='.urlencode($username).'&password='[b].$newpw[/b]);