Beispiel #1
0
 public function bindEmail()
 {
     $postData = utils::_filter_input(input::get());
     $userId = userAuth::id();
     try {
         if (md5($userId) != $postData['verify']) {
             throw new \LogicException(app::get('topc')->_('用户不一致!'));
         }
         if (!userVcode::verify($postData['vcode'], $postData['uname'], $postData['type'])) {
             throw new \LogicException(app::get('topc')->_('验证码错误'));
             return false;
         }
         $data['user_id'] = $userId;
         $data['email'] = $postData['uname'];
         app::get('topc')->rpcCall('user.email.verify', $data, 'buyer');
     } catch (Exception $e) {
         $msg = $e->getMessage();
         return $this->splash('error', null, $msg);
     }
     $pagedata['sendType'] = 'email';
     $pagedata['action'] = 'topc_ctl_member@bindEmail';
     $this->action_view = "setinfolast.html";
     return $this->output($pagedata);
 }
Beispiel #2
0
 public function findPwdThree()
 {
     $postData = utils::_filter_input(input::get());
     $vcode = $postData['vcode'];
     $loginName = $postData['uname'];
     $sendType = $postData['type'];
     $accountType = kernel::single('pam_tools')->checkLoginNameType($loginName);
     try {
         $vcodeData = userVcode::verify($vcode, $loginName, $sendType);
         if (!$vcodeData) {
             throw new \LogicException('验证码输入错误');
         }
     } catch (Exception $e) {
         $msg = $e->getMessage();
         return $this->splash('error', null, $msg);
     }
     $userInfo = userAuth::getAccountInfo($loginName);
     $key = userVcode::getVcodeKey($loginName, $sendType);
     $userInfo['key'] = md5($vcodeData['vcode'] . $key . $userInfo['user_id']);
     $pagedata['data'] = $userInfo;
     $pagedata['account'] = $loginName;
     if ($accountType == "email") {
         return $this->page('topm/passport/forgot/email_three.html', $pagedata);
     } else {
         return $this->page('topm/passport/forgot/three.html', $pagedata);
     }
 }
Beispiel #3
0
 /**
  * 会员中心信息修改最后一步
  *
  */
 public function saveSetInfo($postData)
 {
     if (!$postData) {
         throw new \LogicException(app::get('sysuser')->_('请填写正确的数据'));
         return false;
     }
     if (!userVcode::verify($postData['vcode'], $postData['uname'], $postData['send_type'])) {
         throw new \LogicException(app::get('sysuser')->_('验证码错误'));
         return false;
     }
     $type = kernel::single('pam_tools')->checkLoginNameType($postData['uname']);
     $userId = pamAccount::getAccountId();
     $db = app::get('sysuser')->database();
     $transaction_status = $db->beginTransaction();
     try {
         if ($type == 'email' && $userId) {
             $data = array('user_id' => $userId, 'email' => $postData['uname']);
             $user = app::get('sysuser')->model('account')->getRow('user_id', array('email' => $postData['uname']));
             if ($user['user_id']) {
                 throw new \LogicException(app::get('sysuser')->_('该邮箱以被绑定'));
             }
         }
         if ($type == 'mobile' && $userId) {
             $user = app::get('sysuser')->model('account')->getRow('user_id', array('mobile' => $postData['uname']));
             if ($user['user_id']) {
                 throw new \LogicException(app::get('sysuser')->_('该手机号以被绑定'));
             }
             $data = array('user_id' => $userId, 'mobile' => $postData['uname']);
         }
         $objPamMdlUser = app::get('sysuser')->model('account');
         if (!$objPamMdlUser->save($data)) {
             throw new \LogicException(app::get('sysuser')->_("{$type}认证失败"));
         }
         $db->commit($transaction_status);
     } catch (Exception $e) {
         $db->rollback();
         throw $e;
     }
     return true;
 }
Beispiel #4
0
 /**
  * @brief 会员中心安全中心的最后一步
  *
  * @return true or false
  */
 public function saveSetInfo()
 {
     $postData = utils::_filter_input(input::get());
     try {
         $sendType = kernel::single('pam_tools')->checkLoginNameType($postData['uname']);
         $postData['user_id'] = userAuth::id();
         if (!userVcode::verify($postData['vcode'], $postData['uname'], $postData['type'])) {
             throw new \LogicException(app::get('topm')->_('验证码错误'));
             return false;
         }
         $data['user_id'] = $postData['user_id'];
         $data['user_name'] = $postData['uname'];
         app::get('topm')->rpcCall('user.account.update', $data, 'buyer');
     } catch (Exception $e) {
         $msg = $e->getMessage();
         return $this->splash('error', null, $msg);
     }
     $url = url::action("topm_ctl_member@setUserInfoTwo", array('sendType' => $sendType));
     return $this->splash('success', $url, null);
 }