diff --git a/config/zentaopms.php b/config/zentaopms.php index ad13b06eb5..8a9daff5c8 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -224,6 +224,9 @@ $config->openMethods[] = 'user.refreshrandom'; $config->openMethods[] = 'user.reset'; $config->openMethods[] = 'user.resetpassword'; $config->openMethods[] = 'admin.register'; +$config->openMethods[] = 'admin.getcaptcha'; +$config->openMethods[] = 'admin.sendcode'; +$config->openMethods[] = 'admin.planmodal'; /* 登录用户可以使用的方法。The methods that can be used by the logged users. */ $config->logonMethods = array(); diff --git a/module/admin/control.php b/module/admin/control.php index 71c97e46c2..77acecc771 100755 --- a/module/admin/control.php +++ b/module/admin/control.php @@ -514,11 +514,7 @@ class admin extends control if($bindCommunity) { if(!$this->loadModel('user')->isLogon()) $this->locate(helper::createLink('user', 'deny', 'module=admin&method=register')); - - $agreeUX = $this->config->global->agreeUX == 'true';; $bindCommunityMobile = $this->config->global->bindCommunityMobile; - - $this->view->agreeUX = $agreeUX; $this->view->bindCommunityMobile = $bindCommunityMobile; } else @@ -530,28 +526,37 @@ class admin extends control $zentaosid = $_COOKIE[$sessionVar]; $apiURL = $apiRoot . "/user-apiRegister.json" . "?{$sessionVar}={$zentaosid}"; + if(empty($this->config->global->sn)) $this->loadModel('setting')->setSN(); $httpData['sn'] = $this->config->global->sn; - $httpData['mobile'] = $this->post->agreeUX; + $httpData['mobile'] = $this->post->mobile; $httpData['code'] = $this->post->code; $response = common::http($apiURL, $httpData); + $response = json_decode($response, true); - if($response['result'] == 'fail') return $this->send(array('result' => 'fail', 'message' => $response['message'])); + if($response['result'] == 'success') + { + if(!isset($this->config->global)) $this->config->global = new stdclass(); - if(!isset($this->config->global)) $this->config->global = new stdclass(); + $this->loadModel('setting')->setItem('system.common.global.bindCommunity', 'true'); + $this->loadModel('setting')->setItem('system.common.global.bindCommunityMobile', $this->post->mobile); + $this->config->global->bindCommunity = 'true'; + $this->config->global->bindCommunityMobile = $this->post->mobile; - $this->loadModel('setting')->setItem('system.common.global.bindCommunity', 'true'); - $this->loadModel('setting')->setItem('system.common.global.bindCommunityMobile', $this->post->mobile); - $this->config->global->bindCommunity = 'true'; - $this->config->global->bindCommunityMobile = $this->post->mobile; + $agreeUX = $this->post->agreeUX; + $this->loadModel('setting')->setItem('system.common.global.agreeUX', $agreeUX); + $this->config->global->agreeUX = $agreeUX; - $agreeUX = $this->post->agreeUX; - if($agreeUX) $this->loadModel('setting')->setItem('system.common.global.agreeUX', 'true'); - $this->config->global->agreeUX = 'true'; - return $this->send(array('result' => 'success', 'load' => inlink('register') . '#app=admin')); + return $this->send(array('result' => 'success', 'load' => inlink('register') . '#app=admin')); + } + return $this->send(array('result' => 'fail', 'message' => $response['message'] ?: $this->lang->admin->register->loginFailed)); } } + + $agreeUX = $this->config->global->agreeUX == 'true'; + + $this->view->agreeUX = $agreeUX; $this->view->bindCommunity = $bindCommunity; $this->display(); } diff --git a/module/admin/lang/zh-cn.php b/module/admin/lang/zh-cn.php index 7be84f5095..597b23c4f9 100755 --- a/module/admin/lang/zh-cn.php +++ b/module/admin/lang/zh-cn.php @@ -227,6 +227,7 @@ $lang->admin->ai->assistant = 'AI 助手'; $lang->admin->register = new stdclass(); $lang->admin->register->registerTitle = '加入禅道社区'; $lang->admin->register->uxPlanTitle = '用户体验计划'; +$lang->admin->register->loginFailed = '登录失败'; $lang->admin->register->uxPlan = new stdclass(); $lang->admin->register->uxPlan->agree = '已同意';