@@ -37,8 +37,6 @@ public function doRequest()
3737 if ($ method == "post " ) {
3838
3939 $ loginName = $ _POST ['loginName ' ];
40- $ newPassword = $ _POST ['newPassword ' ];
41- $ oldPassword = $ _POST ['oldPassword ' ];
4240
4341 $ siteLoginName = $ this ->loginName ;
4442 if ($ siteLoginName != $ loginName ) {
@@ -47,14 +45,8 @@ public function doRequest()
4745 echo json_encode (["errCode " => $ errorInfo ]);
4846 return ;
4947 }
50- if (strlen ($ newPassword )<5 || strlen ($ newPassword )>20 ) {
51- $ errorCode = $ this ->zalyError ->errorPassowrdLength ;
52- $ errorInfo = $ this ->zalyError ->getErrorInfo ($ errorCode );
53- echo json_encode (["errCode " => $ errorInfo ]);
54- return ;
55- }
5648
57- $ this ->modifyPassportPassword ($ loginName, $ oldPassword , $ newPassword );
49+ $ this ->modifyPassportPassword ($ loginName );
5850 echo json_encode (["errCode " => "success " ]);
5951 return ;
6052 } else {
@@ -69,22 +61,15 @@ public function doRequest()
6961 }
7062 }
7163
72- private function modifyPassportPassword ($ loginName, $ oldPassword , $ newPassword )
64+ private function modifyPassportPassword ($ loginName )
7365 {
7466 $ tag = __CLASS__ . "- " . __FUNCTION__ ;
7567
7668 try {
77- $ modifyPasswordReq = new \Zaly \Proto \Site \ApiPassportPasswordModifyPasswordRequest ();
78- $ modifyPasswordReq ->setLoginName ($ loginName );
79- $ modifyPasswordReq ->setPassword ($ oldPassword );
80- $ modifyPasswordReq ->setNewPassword ($ newPassword );
81- $ updatePasswordUrl = "/index.php?action= " . $ this ->resetPassword . "&body_format=pb " ;
82- $ updatePasswordUrl = ZalyHelper::getFullReqUrl ($ updatePasswordUrl );
83- $ this ->sendReq ( $ this ->resetPassword , $ updatePasswordUrl , $ modifyPasswordReq );
8469
8570 $ sessionClearRequest = new \Zaly \Proto \Plugin \DuckChatSessionClearRequest ();
8671 $ sessionClearRequest ->setUserId ($ this ->userId );
87- $ sessionClearUrl = "/index.php?action= " . $ this ->sessionClear . "&body_format=pb &miniProgramId= " .$ this ->passporAccountPluginId ;
72+ $ sessionClearUrl = "/index.php?action= " . $ this ->sessionClear . "&body_format=base64pb &miniProgramId= " .$ this ->passporAccountPluginId ;
8873 $ sessionClearUrl = ZalyHelper::getFullReqUrl ($ sessionClearUrl );
8974 $ this ->sendReq ($ this ->sessionClear , $ sessionClearUrl , $ sessionClearRequest );
9075 }catch (Exception $ ex ) {
@@ -104,20 +89,16 @@ private function sendReq($action, $url, $dataReq)
10489 $ transportData ->setAction ($ action );
10590 $ transportData ->setHeader (["_ " .\Zaly \Proto \Core \TransportDataHeaderKey::HeaderUserClientLang => $ this ->language ]);
10691 $ data = $ transportData ->serializeToString ();
92+ $ data = base64_encode ($ data );
10793
10894 $ pluginProfile = $ this ->getMiniProgramProfile ($ this ->passporAccountPluginId );
109-
110- if ($ action == $ this ->sessionClear ) {
111- $ authKey = $ pluginProfile ['authKey ' ];
112- $ data = $ this ->ctx ->ZalyAes ->encrypt ($ data , $ authKey );
113- }
95+ $ authKey = $ pluginProfile ['authKey ' ];
96+ $ data = $ this ->ctx ->ZalyAes ->encrypt ($ data , $ authKey );
11497
11598 $ result = $ this ->ctx ->ZalyCurl ->request ("post " , $ url , $ data );
116-
117- if ($ action == $ this ->sessionClear ) {
118- $ authKey = $ pluginProfile ['authKey ' ];
119- $ result = $ this ->ctx ->ZalyAes ->decrypt ($ data , $ authKey );
120- }
99+ $ authKey = $ pluginProfile ['authKey ' ];
100+ $ result = $ this ->ctx ->ZalyAes ->decrypt ($ result , $ authKey );
101+ $ result = base64_decode ($ result );
121102
122103 //解析数据
123104 $ transportData = new \Zaly \Proto \Core \TransportData ();
0 commit comments