* adjust for sendcloud.

This commit is contained in:
wangyidong
2016-12-19 16:34:33 +08:00
parent 9447a00b75
commit 22eb0f10cd
5 changed files with 30 additions and 26 deletions
+10 -6
View File
@@ -68,9 +68,9 @@ class admin extends control
$response = json_decode($response);
if($response->result == 'success')
{
$user = json_decode($response->data);
$user = $response->data;
$data['community'] = $user->account;
$data['ztPrivateKey'] = $user->privateKey;
$data['ztPrivateKey'] = $user->private;
$this->loadModel('setting');
$this->setting->deleteItems('owner=system&module=common&section=global&key=community');
@@ -80,9 +80,13 @@ class admin extends control
echo js::alert($this->lang->admin->register->success);
if($from == 'admin') die(js::locate(inlink('index'), 'parent'));
if($from == 'mail') die(js::locate($this->createLink('mail', 'ztcloud'), 'parent'));
}
die($response);
}
}
$alertMessage = '';
foreach($response->message as $item) $alertMessage .= is_array($item) ? join('\n', $item) . '\n' : $item . '\n';
$alertMessage = str_replace(array('<strong>', '</strong>'), '', $alertMessage);
die(js::alert($alertMessage));
}
$this->view->title = $this->lang->admin->register->caption;
$this->view->position[] = $this->lang->admin->register->caption;
@@ -108,7 +112,7 @@ class admin extends control
{
$user = $response->data;
$data['community'] = $user->account;
$data['ztPrivateKey'] = $user->privateKey;
$data['ztPrivateKey'] = $user->private;
$this->loadModel('setting');
$this->setting->deleteItems('owner=system&module=common&section=global&key=community');
+13 -18
View File
@@ -109,7 +109,7 @@ class adminModel extends model
*/
public function registerByAPI()
{
$apiURL = 'http://www.zentao.net/user-register.json';
$apiURL = 'http://www.zentao.net/user-register.json?bind=yes&HTTP_X_REQUESTED_WITH=XMLHttpRequest';
return $this->postAPI($apiURL, $_POST);
}
@@ -121,17 +121,16 @@ class adminModel extends model
*/
public function bindByAPI()
{
$apiURL = 'http://www.zentao.net/user-login.json';
$apiURL = 'http://www.zentao.net/user-bindChanzhi.json?HTTP_X_REQUESTED_WITH=XMLHttpRequest';
return $this->postAPI($apiURL, $_POST);
}
public function getSecretKey()
{
//$apiURL = "http://www.zentao.net/user-secretKey.json";
$apiURL = "http://www.zentao.cn/user-secretKey.json";
$params['account'] = $this->config->global->community;
$apiURL = "http://www.zentao.net/user-secretKey.json";
$params['u'] = $this->config->global->community;
$params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
$params['signature'] = $this->getSignature($params);
$params['k'] = $this->getSignature($params);
$this->agent->cookies['lang'] = $this->cookie->lang;
$this->agent->fetch($apiURL . '?' . http_build_query($params));
$result = $this->agent->results;
@@ -142,11 +141,10 @@ class adminModel extends model
public function sendCodeByAPI($type)
{
$module = $type == 'mobile' ? 'sms' : 'mail';
// $apiURL = "http://www.zentao.net/{$module}-apiSendCode.json";
$apiURL = "http://www.zentao.cn/{$module}-apiSendCode.json";
$params['account'] = $this->config->global->community;
$apiURL = "http://www.zentao.net/{$module}-apiSendCode.json";
$params['u'] = $this->config->global->community;
$params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
$params['signature'] = $this->getSignature($params);
$params['k'] = $this->getSignature($params);
$param = http_build_query($params);
return $this->postAPI($apiURL . '?' . $param, $_POST);
@@ -155,11 +153,10 @@ class adminModel extends model
public function certifyByAPI($type)
{
$module = $type == 'mobile' ? 'sms' : 'mail';
// $apiURL = "http://www.zentao.net/{$module}-apiCertify.json";
$apiURL = "http://www.zentao.cn/{$module}-apiCertify.json";
$params['account'] = $this->config->global->community;
$apiURL = "http://www.zentao.net/{$module}-apiCertify.json";
$params['u'] = $this->config->global->community;
$params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
$params['signature'] = $this->getSignature($params);
$params['k'] = $this->getSignature($params);
$param = http_build_query($params);
return $this->postAPI($apiURL . '?' . $param, $_POST);
@@ -167,11 +164,9 @@ class adminModel extends model
public function getSignature($params)
{
ksort($params);
$data = '';
foreach($params as $key => $value) $data .= $key . '=' . $value . '&';
unset($params['u']);
$privateKey = $this->config->global->ztPrivateKey;
return md5($privateKey . '&' . $data . $privateKey);
return md5(http_build_query($params) . md5($privateKey));
}
/**
+4 -1
View File
@@ -503,7 +503,10 @@ class mail extends control
die(js::locate($this->createLink('admin', 'register', 'from=mail')));
}
$result = $this->loadModel('admin')->getSecretKey();
$data = $result->data;
if(empty($result))die(js::alert($this->lang->mail->connectFail) . js::locate('back'));
if($result->result == 'fail' and empty($result->data)) die(js::alert($this->lang->mail->centifyFail));
$data = $result->data;
if($result->result == 'fail' and empty($data->emailCertified))
{
die(js::locate($this->createLink('admin', 'certifyZtEmail', 'email=' . helper::safe64Encode($data->email))));
+1 -1
View File
@@ -1,5 +1,5 @@
function agreeLicense()
{
$.cookie('ztCloudLicense', 'yes', {expires:config.cookieLife, path:config.webRoot});
$.cookie('ztCloudLicense', 'yes', {path:config.webRoot});
self.location.href=self.location.href;
}
+2
View File
@@ -77,6 +77,8 @@ $lang->mail->successSended = '成功发送!';
$lang->mail->confirmDelete = '是否删除邮件?';
$lang->mail->sendmailTips = '提示:系统不会为当前操作者发信。';
$lang->mail->needConfigure = '无法找到邮件配置信息,请先配置邮件发送参数。';
$lang->mail->connectFail = '无法连接禅道网站。';
$lang->mail->centifyFail = '验证失败,可能密钥已经修改。请重新绑定!';
$lang->mail->nofsocket = 'fsocket相关函数被禁用,不能发信!请在php.ini中修改allow_url_fopen为On,打开openssl扩展。 保存并重新启动apache。';
$lang->mail->noOpenssl = 'ssl和tls加密,请打开openssl扩展。 保存并重新启动apache。';
$lang->mail->disableSecure = '没有openssl扩展,禁用ssl和tls加密';