Esempio n. 1
0
 /**
  * 检查用户输入的用户名
  */
 public function checknameAction()
 {
     $login = new PwLoginService();
     $info = $login->checkInput($this->getInput('username'));
     if (!$info) {
         $this->showError('USER:user.error.-14');
     }
     if (!empty($info['safecv'])) {
         Wind::import('SRV:user.srv.PwRegisterService');
         $registerService = new PwRegisterService();
         $status = PwLoginService::createLoginIdentify($registerService->sysUser($info['uid']));
         $identify = base64_encode($status . '|');
         $this->addMessage($this->_getQuestions(), 'safeCheck');
         $this->addMessage($identify, '_statu');
         $this->showMessage();
     }
     $this->showMessage();
 }
Esempio n. 2
0
 /**
  * 执行用户注册
  */
 public function quickRegisterAction()
 {
     $registerService = new PwRegisterService();
     $registerService->setUserDm($this->_getUserDm());
     /*[u_regsiter]:插件扩展*/
     $this->runHook('c_register', $registerService);
     if (($info = $registerService->register()) instanceof PwError) {
         $this->showError($info->getError());
     } else {
         Wind::import('SRV:user.srv.PwLoginService');
         $service = new PwLoginService();
         Windid::load('user.WindidUser');
         $info = $service->sysUser($info['uid']);
         $identity = PwLoginService::createLoginIdentify($info);
         $identity = base64_encode($identity);
         $userService = Wekit::load('user.srv.PwUserService');
         $userService->createIdentity($info['uid'], $info['password']);
         $this->forwardRedirect(WindUrlHelper::createUrl('app/4tschool/orderpreview/run', array("message" => $message)));
     }
 }
Esempio n. 3
0
 /**
  * 检查用户输入的用户名
  */
 public function checknameAction()
 {
     $login = new PwLoginService();
     list($status, $info) = $login->auth($this->getInput('username'), '');
     if (-1 == $status) {
         $this->showError('USER:user.error.-14');
     }
     if (!empty($info['safecv'])) {
         $status = PwLoginService::createLoginIdentify($login->sysUser($info['uid']));
         $identify = base64_encode($status . '|');
         $this->addMessage($this->_getQuestions(), 'safeCheck');
         $this->addMessage($identify, '_statu');
         $this->showMessage();
     }
     $this->showMessage();
 }
Esempio n. 4
0
 function bind_user($uid = 0)
 {
     if ($uid == 0) {
         $uid = $this->get_uid();
     }
     Wind::import('SRV:user.srv.PwLoginService');
     $service = new PwLoginService();
     //$this->runHook('c_login_dorun', $login);
     Windid::load('user.WindidUser');
     $info = $service->sysUser($uid);
     $identity = PwLoginService::createLoginIdentify($info);
     $identity = base64_encode($identity);
     $userService = Wekit::load('user.srv.PwUserService');
     $userService->updateLastLoginData($info['uid'], $this->getRequest()->getClientIp());
     $userService->createIdentity($info['uid'], $info['password']);
     //到主页去
     $this->forwardRedirect(WindUrlHelper::createUrl('app/4tschool/index/run'));
     $this->showMessage('欢迎回来…', '/');
 }
Esempio n. 5
0
 public function makeOrderAction()
 {
     //get data
     $merchandisesInfo = $this->getInput("merchandisesInfo", "post");
     $id = $this->getInput("id", "post");
     $to = $this->getInput("orderContactor", "post");
     $phone = $this->getInput("orderPhone", "post");
     $address = $this->getInput("orderAddress", "post");
     $note = $this->getInput("orderRemark", "post");
     $orderExpressTime = $this->getInput("orderExpressTime", "post");
     $orderHour = $this->getInput('orderHour', "post");
     $orderMinutes = $this->getInput('orderMinutes', "post");
     $orderTime = $orderHour . ':' . $orderMinutes;
     $schoolId = $this->getCurrentSchoolId();
     if (empty($merchandisesInfo)) {
         //show not correct message
         return;
     } else {
         $merchandisesInfo = (array) json_decode($merchandisesInfo);
     }
     $to = trim($to);
     $phone = trim($phone);
     $address = trim($address);
     if (empty($to) || empty($phone) || empty($address)) {
         echo '无效的数据';
         die;
     }
     $orderItems = $merchandisesInfo['merchandises'];
     $shopDeduct = array();
     //calculate the promo
     $orderMerchandiseList = $this->jcart->get_contents();
     $promos = $this->_getPromoDs()->matchedPromoInCart($orderMerchandiseList);
     //calculate deduct price
     foreach ($promos['Match'] as $item) {
         if ($item['ShopId'] == $shopid) {
             $shopDeduct['ShopId'] += $item['Deduct'];
         }
     }
     $hasException = false;
     $userid = $this->loginUser->uid;
     $this->_getOrderAddressDs()->addorUpdateOrderAddress($id, $userid, $to, $address, $phone);
     $newCreated = false;
     if ($userid <= 0) {
         //generate tmp userid
         $newInfo = $this->_getTmpUserDS()->registerTmpUser(1);
         $userid = $newInfo['uid'];
         $newCreated = true;
     }
     try {
         //start transaction
         $this->_getMyOrderDS()->startTran();
         $generatedIds = $this->_getMyOrderDS()->makeOrder($userid, $schoolId, $orderItems, $to, $phone, $address, $note, '网站');
     } catch (Exception $e) {
         $hasException = true;
         $this->_getMyOrderDS()->rollBack();
     }
     if ($hasException == false) {
         $message = "下单成功";
         $this->_getMyOrderDS()->commit();
     } else {
         $message = "下单失败,请联系系统管理员";
     }
     //清空购物车
     $this->jcart->empty_cart();
     if ($newCreated == true) {
         Wind::import('SRV:user.srv.PwLoginService');
         $service = new PwLoginService();
         Windid::load('user.WindidUser');
         $info = $service->sysUser($userid);
         $identity = PwLoginService::createLoginIdentify($info);
         $identity = base64_encode($identity);
         $userService = Wekit::load('user.srv.PwUserService');
         $userService->createIdentity($info['uid'], $info['password']);
         //跳转到我的订单的画面
         $this->forwardRedirect(WindUrlHelper::createUrl('app/4tschool/schoolorder/myorder', array("message" => $message)));
     } else {
         //跳转到我的订单的画面
         $this->forwardRedirect(WindUrlHelper::createUrl('app/4tschool/schoolorder/myorder', array("message" => $message)));
     }
 }
 public function dorunAction()
 {
     $userForm = $this->_getLoginForm();
     /* [验证验证码是否正确] */
     if ($this->_showVerify()) {
         $veryfy = $this->_getVerifyService();
         if ($veryfy->checkVerify($userForm['code']) !== true) {
             $this->showError('USER:verifycode.error');
         }
     }
     $question = $userForm['question'];
     if ($question == -4) {
         $question = $this->getInput('myquestion', 'post');
     }
     /* [验证用户名和密码是否正确] */
     $login = new PwLoginService();
     $this->runHook('c_login_dorun', $login);
     $isSuccess = $login->login($userForm['username'], $userForm['password'], $this->getRequest()->getClientIp(), $question, $userForm['answer']);
     if ($isSuccess instanceof PwError) {
         $this->showError($isSuccess->getError());
     }
     $config = Wekit::C('site');
     if ($config['windid'] != 'local') {
         $localUser = $this->_getUserDs()->getUserByUid($isSuccess['uid'], PwUser::FETCH_MAIN);
         if ($localUser['username'] && $userForm['username'] != $localUser['username']) {
             $this->showError('USER:user.syn.error');
         }
     }
     Wind::import('SRV:user.srv.PwRegisterService');
     $registerService = new PwRegisterService();
     $info = $registerService->sysUser($isSuccess['uid']);
     if (!$info) {
         $this->showError('USER:user.syn.error');
     }
     $identity = PwLoginService::createLoginIdentify($info);
     // dump($_GET);
     // exit;
     if (isset($_GET['backurl'])) {
         $backurl = $_GET['backurl'];
     } else {
         $backurl = 'index.php?m=app&app=nanatools';
     }
     // $identity = base64_encode($identity . '|' . $this->getInput('backurl') . '|' . $userForm['rememberme']);
     $identity = base64_encode($identity . '|' . $backurl . '|' . $userForm['rememberme']);
     /* [是否需要设置安全问题] */
     /* @var $userService PwUserService */
     $userService = Wekit::load('user.srv.PwUserService');
     //解决浏览器记录用户帐号和密码问题
     if ($isSuccess['safecv'] && !$question) {
         $this->addMessage(true, 'qaE');
         $this->showError('USER:verify.question.empty');
     }
     //该帐号必须设置安全问题
     if (empty($isSuccess['safecv']) && $userService->mustSettingSafeQuestion($info['uid'])) {
         $this->addMessage(array('url' => WindUrlHelper::createUrl('u/login/setquestion', array('v' => 1, '_statu' => $identity))), 'check');
     }
     // $this->showMessage('http://taita.xyz/upload/index.php?m=u&c=login&a=welcome&_statu=' . $identity);
     header("location: index.php?m=u&c=login&a=welcome&_statu=" . $identity);
     // $this->showMessage('123', 'u/login/welcome?_statu=' . $identity);
     // exit;
 }