* [perf] remove admin register page.
This commit is contained in:
@@ -77,101 +77,6 @@ class admin extends control
|
||||
return $this->send(array('result' => 'success'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 登记禅道社区。
|
||||
* Register zentao.
|
||||
*
|
||||
* @param string $from admin|mail
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function register(string $from = 'admin')
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
$response = $this->adminZen->registerByAPI();
|
||||
$response = json_decode($response);
|
||||
if($response->result == 'fail')
|
||||
{
|
||||
$message = '';
|
||||
if(is_string($response->message))
|
||||
{
|
||||
$message = $response->message;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($response->message as $item) $message .= is_array($item) ? join('\n', $item) . '\n' : $item . '\n';
|
||||
}
|
||||
$message = str_replace(array('<strong>', '</strong>'), '', $message);
|
||||
|
||||
return $this->send(array('result' => 'fail', 'message' => $message));
|
||||
}
|
||||
|
||||
$user = $response->data;
|
||||
$data['community'] = $user->account;
|
||||
$data['ztPrivateKey'] = $user->private;
|
||||
|
||||
$this->loadModel('setting');
|
||||
$this->setting->deleteItems('owner=system&module=common§ion=global&key=community');
|
||||
$this->setting->deleteItems('owner=system&module=common§ion=global&key=ztPrivateKey');
|
||||
$this->setting->setItems('system.common.global', $data);
|
||||
|
||||
$locate = true;
|
||||
if($from == 'admin') $locate = inlink('index');
|
||||
if($from == 'mail') $locate = $this->createLink('mail', 'ztcloud');
|
||||
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->admin->registerNotice->success, 'load' => $locate));
|
||||
}
|
||||
|
||||
$this->adminZen->initSN();
|
||||
|
||||
$this->view->title = $this->lang->admin->registerNotice->caption;
|
||||
$this->view->register = $this->adminZen->getRegisterInfo();
|
||||
$this->view->sn = $this->config->global->sn;
|
||||
$this->view->from = $from;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定禅道账号。
|
||||
* Bind zentao.
|
||||
*
|
||||
* @param string $from admin|mail
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function bind(string $from = 'admin')
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
$response = $this->adminZen->bindByAPI();
|
||||
$response = json_decode($response);
|
||||
|
||||
if($response->result == 'fail') return $this->send($response);
|
||||
|
||||
$user = $response->data;
|
||||
$data['community'] = $user->account;
|
||||
$data['ztPrivateKey'] = $user->private;
|
||||
|
||||
$this->loadModel('setting')->deleteItems('owner=system&module=common§ion=global&key=community');
|
||||
$this->setting->deleteItems('owner=system&module=common§ion=global&key=ztPrivateKey');
|
||||
$this->setting->setItems('system.common.global', $data);
|
||||
|
||||
$locate = true;
|
||||
if($from == 'admin') $locate = inlink('index');
|
||||
if($from == 'mail') $locate = $this->createLink('mail', 'ztcloud');
|
||||
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->admin->bind->success, 'load' => $locate));
|
||||
}
|
||||
|
||||
$this->adminZen->initSN();
|
||||
|
||||
$this->view->title = $this->lang->admin->bind->caption;
|
||||
$this->view->sn = $this->config->global->sn;
|
||||
$this->view->from = $from;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统安全设置。
|
||||
* System security Settings.
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* The register view file of admin module of ZenTaoPMS.
|
||||
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
|
||||
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Gang Liu <liugang@easycorp.ltd>
|
||||
* @package admin
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
namespace zin;
|
||||
|
||||
$canBind = hasPriv('admin', 'bind');
|
||||
|
||||
$account = zget($config->global, 'community', '');
|
||||
if($account == 'na') $account = '';
|
||||
|
||||
$buildCaptchRow = function($type) : node
|
||||
{
|
||||
global $lang;
|
||||
return formRow
|
||||
(
|
||||
formGroup
|
||||
(
|
||||
setClass('w-1/2'),
|
||||
set::label($lang->user->$type),
|
||||
set::required(true),
|
||||
inputGroup
|
||||
(
|
||||
input
|
||||
(
|
||||
set::name($type)
|
||||
),
|
||||
span
|
||||
(
|
||||
setClass('input-group-btn'),
|
||||
button
|
||||
(
|
||||
on::click("sendCaptcha(event, '{$type}')"),
|
||||
setClass('btn'),
|
||||
set(array('data-url' => inlink('ajaxSendCode', "type={$type}"))),
|
||||
$lang->admin->getCaptcha
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
setClass('w-1/2'),
|
||||
set::label($lang->admin->captcha),
|
||||
set::name("{$type}Code"),
|
||||
set::required(true)
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
$buildHidden = function($sn, $siteName): array
|
||||
{
|
||||
$items[] = input
|
||||
(
|
||||
set::type('hidden'),
|
||||
set::name('sn'),
|
||||
set::value($sn)
|
||||
);
|
||||
$items[] = input
|
||||
(
|
||||
set::type('hidden'),
|
||||
set::name($siteName),
|
||||
set::value(common::getSysURL())
|
||||
);
|
||||
return $items;
|
||||
};
|
||||
|
||||
div
|
||||
(
|
||||
setClass('flex'),
|
||||
col
|
||||
(
|
||||
setClass($canBind ? 'pr-2 w-1/2' : 'w-full'),
|
||||
formPanel
|
||||
(
|
||||
setClass('w-full'),
|
||||
set::actions(array('submit')),
|
||||
set::title($lang->admin->registerNotice->common),
|
||||
set::submitBtnText($lang->admin->registerNotice->submit),
|
||||
formGroup
|
||||
(
|
||||
set::label($lang->user->account),
|
||||
set::name('account'),
|
||||
set::placeholder($lang->admin->registerNotice->lblAccount),
|
||||
set::required(true)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::label($lang->user->realname),
|
||||
set::name('realname'),
|
||||
set::required(true)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::label($lang->user->company),
|
||||
set::name('company'),
|
||||
set::value($register->company),
|
||||
set::required(true)
|
||||
),
|
||||
empty($config->isINT) ? $buildCaptchRow('mobile') : null,
|
||||
$buildCaptchRow('email'),
|
||||
formGroup
|
||||
(
|
||||
set::label($lang->user->password),
|
||||
set::control('password'),
|
||||
set::name('password1'),
|
||||
set::placeholder($lang->admin->registerNotice->lblPasswd),
|
||||
set::required(true)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
set::label($lang->user->password2),
|
||||
set::control('password'),
|
||||
set::name('password2'),
|
||||
set::required(true)
|
||||
),
|
||||
$buildHidden($sn, 'bindSite')
|
||||
)
|
||||
),
|
||||
$canBind ? col
|
||||
(
|
||||
setClass('pl-2 w-1/2'),
|
||||
formPanel
|
||||
(
|
||||
setClass('w-full'),
|
||||
set::actions(array('submit')),
|
||||
set::title($lang->admin->registerNotice->bind),
|
||||
set::url(inlink('bind', "from={$from}")),
|
||||
set::submitBtnText($lang->admin->bind->submit),
|
||||
formGroup
|
||||
(
|
||||
setClass('w-1/2'),
|
||||
set::label($lang->user->account),
|
||||
set::name('account'),
|
||||
set::value($account),
|
||||
set::required(true)
|
||||
),
|
||||
formGroup
|
||||
(
|
||||
setClass('w-1/2'),
|
||||
set::label($lang->user->password),
|
||||
set::control('password'),
|
||||
set::name('password'),
|
||||
set::required(true)
|
||||
),
|
||||
$buildHidden($sn, 'site')
|
||||
)
|
||||
) : null
|
||||
);
|
||||
|
||||
render();
|
||||
@@ -1,171 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* The view file of bug module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
|
||||
* @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
|
||||
* @package admin
|
||||
* @version $Id: view.html.php 2568 2012-02-09 06:56:35Z shiyangyangwork@yahoo.cn $
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<style>
|
||||
#mainContent table {width: 95%;}
|
||||
.input-group .input-group-btn .popover {font-size: 12px;}
|
||||
.input-group-btn .btn {border-left: 0px}
|
||||
.input-group:last-child .input-group-addon {border-right: 0px;}
|
||||
</style>
|
||||
<div id='mainMenu' class='clearfix'>
|
||||
<div class='btn-toolbar pull-left'>
|
||||
<span class='btn btn-link btn-active-text'><span class='text'><?php echo $lang->admin->registerNotice->caption;?></span></span>
|
||||
</div>
|
||||
</div>
|
||||
<div id='mainContent' class='main-row'>
|
||||
<div <?php if(common::hasPriv('admin', 'bind')) echo "class='col-md-6'";?>>
|
||||
<div class='panel'>
|
||||
<div class='panel-heading'><strong><?php echo $lang->admin->registerNotice->common?></strong></div>
|
||||
<form class='mw-600px' method="post" target="hiddenwin">
|
||||
<table align='center' class='table table-form'>
|
||||
<tr>
|
||||
<th class='w-100px'><?php echo $lang->user->account;?></th>
|
||||
<td>
|
||||
<div class="required required-wrapper"></div>
|
||||
<?php echo html::input('account', '', "class='form-control' placeholder='{$lang->admin->registerNotice->lblAccount}'");?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->user->realname;?></th>
|
||||
<td><div class="required required-wrapper"></div><?php echo html::input('realname', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->user->company;?></th>
|
||||
<td><div class="required required-wrapper"></div><?php echo html::input('company', $register->company, "class='form-control'");?></td>
|
||||
</tr>
|
||||
<?php if(empty($config->isINT)):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->user->mobile;?></th>
|
||||
<td>
|
||||
<div class="required required-wrapper"></div>
|
||||
<div class='input-group'>
|
||||
<?php echo html::input('mobile', '', "class='form-control'");?>
|
||||
<span class='input-group-btn'><?php echo html::a(inlink('ajaxSendCode', 'type=mobile'), $lang->admin->getCaptcha, '', "id='mobileSender' class='btn'")?></span>
|
||||
<span class='input-group-addon' style='border:0px;background:none'></span>
|
||||
<span class='input-group-addon'><?php echo $lang->admin->captcha?></span>
|
||||
<?php echo html::input('mobileCode', '', "class='form-control'");?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<th><?php echo $lang->user->email;?></th>
|
||||
<td>
|
||||
<div class="required required-wrapper"></div>
|
||||
<div class='input-group'>
|
||||
<?php echo html::input('email', $register->email, "class='form-control'");?>
|
||||
<span class='input-group-btn'><?php echo html::a(inlink('ajaxSendCode', 'type=email'), $lang->admin->getCaptcha, '', "id='mailSender' class='btn'")?></span>
|
||||
<span class='input-group-addon' style='border:0px;background:none'></span>
|
||||
<span class='input-group-addon'><?php echo $lang->admin->captcha?></span>
|
||||
<?php echo html::input('emailCode', '', "class='form-control'");?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->user->password;?></th>
|
||||
<td>
|
||||
<div class="required required-wrapper"></div>
|
||||
<?php echo html::password('password1', '', "class='form-control' placeholder='{$lang->admin->registerNotice->lblPasswd}'");?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->user->password2;?></th>
|
||||
<td>
|
||||
<div class="required required-wrapper"></div>
|
||||
<?php echo html::password('password2', '', "class='form-control'");?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' class='text-center'>
|
||||
<?php echo html::submitButton($lang->admin->registerNotice->submit) . html::hidden('sn', $sn) . html::hidden('bindSite', common::getSysURL());?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php if(common::hasPriv('admin', 'bind')):?>
|
||||
<div class='col-md-6'>
|
||||
<div class='panel'>
|
||||
<div class='panel-heading'><strong><?php echo $lang->admin->registerNotice->bind?></strong></div>
|
||||
<form class='mw-400px' method="post" target="hiddenwin" action='<?php echo inlink('bind', "from=$from")?>'>
|
||||
<table align='center' class='table table-form'>
|
||||
<tr>
|
||||
<th class='w-100px'><?php echo $lang->user->account;?></th>
|
||||
<?php
|
||||
$account = zget($config->global, 'community', '');
|
||||
if($account == 'na') $account = '';
|
||||
?>
|
||||
<td><?php echo html::input('account', $account, "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->user->password;?></th>
|
||||
<td><?php echo html::password('password', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' class="text-center"><?php echo html::submitButton() . html::hidden('sn', $sn) . html::hidden('site', common::getSysURL());?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<script>
|
||||
$(function()
|
||||
{
|
||||
$('#mobileSender').click(function()
|
||||
{
|
||||
var data = {mobile: $('#mobile').val()};
|
||||
var url = $(this).attr('href');
|
||||
|
||||
$.post(url, data, function(response)
|
||||
{
|
||||
if(response.result == 'success')
|
||||
{
|
||||
$('#mobileSender').popover({trigger:'manual', content:response.message, placement:'right'}).popover('show');
|
||||
$('#mobileSender').next('.popover').addClass('popover-success');
|
||||
function distroy(){$('#mobileSender').popover('destroy')}
|
||||
setTimeout(distroy,2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
bootbox.alert(response.message);
|
||||
}
|
||||
}, 'json')
|
||||
return false;
|
||||
})
|
||||
$('#mailSender').click(function()
|
||||
{
|
||||
var data = {email: $('#email').val()};
|
||||
var url = $(this).attr('href');
|
||||
|
||||
$.post(url, data, function(response)
|
||||
{
|
||||
if(response.result == 'success')
|
||||
{
|
||||
$('#mailSender').popover({trigger:'manual', content:response.message, placement:'right'}).popover('show');
|
||||
$('#mailSender').next('.popover').addClass('popover-success');
|
||||
function distroy(){$('#mailSender').popover('destroy')}
|
||||
setTimeout(distroy,2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
bootbox.alert(response.message);
|
||||
}
|
||||
}, 'json')
|
||||
return false;
|
||||
})
|
||||
});
|
||||
</script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
@@ -16,25 +16,6 @@ class adminZen extends admin
|
||||
*/
|
||||
const EXT_MANAGER_VERSION = '1.3';
|
||||
|
||||
/**
|
||||
* 初始化sn。
|
||||
* Init sn.
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function initSN(): void
|
||||
{
|
||||
if(!isset($this->config->global->sn))
|
||||
{
|
||||
$this->loadModel('setting');
|
||||
$this->setting->setItem('system.common.global.sn', $this->setting->computeSN());
|
||||
|
||||
if(!isset($this->config->global)) $this->config->global = new stdclass();
|
||||
$this->config->global->sn = $this->setting->getItem('owner=system&module=common§ion=global&key=sn');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sync extensions from zentao official website by api.
|
||||
*
|
||||
@@ -145,34 +126,6 @@ class adminZen extends admin
|
||||
if(isset($result->data)) return json_decode($result->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册禅道账号。
|
||||
* Register zentao by API.
|
||||
*
|
||||
* @access protected
|
||||
* @return string
|
||||
*/
|
||||
protected function registerByAPI(): string
|
||||
{
|
||||
$apiConfig = $this->admin->getApiConfig();
|
||||
$apiURL = $this->config->admin->apiRoot . "/user-apiRegister.json?HTTP_X_REQUESTED_WITH=XMLHttpRequest&{$apiConfig->sessionVar}={$apiConfig->sessionID}";
|
||||
return common::http($apiURL, $_POST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定禅道账号。
|
||||
* Login zentao by API.
|
||||
*
|
||||
* @access protected
|
||||
* @return string
|
||||
*/
|
||||
protected function bindByAPI(): string
|
||||
{
|
||||
$apiConfig = $this->admin->getApiConfig();
|
||||
$apiURL = $this->config->admin->apiRoot . "/user-bindChanzhi.json?HTTP_X_REQUESTED_WITH=XMLHttpRequest&{$apiConfig->sessionVar}={$apiConfig->sessionID}";
|
||||
return common::http($apiURL, $_POST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送验证码。
|
||||
* Send code by API.
|
||||
@@ -239,21 +192,6 @@ class adminZen extends admin
|
||||
return common::http($apiURL . '?' . $param, $_POST);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取禅道社区注册信息。
|
||||
* Get register information.
|
||||
*
|
||||
* @access protected
|
||||
* @return object
|
||||
*/
|
||||
protected function getRegisterInfo(): object
|
||||
{
|
||||
$register = new stdclass();
|
||||
$register->company = $this->app->company->name;
|
||||
$register->email = $this->app->user->email;
|
||||
return $register;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取禅道官网数据。
|
||||
* Get zentao.net data.
|
||||
|
||||
Reference in New Issue
Block a user