示例#1
0
 public function sendEmailVcode($sendType, $account)
 {
     $userId = userAuth::id();
     switch ($sendType) {
         case 'activation':
         case 'reset':
             $content = url::action("topc_ctl_member@bindEmail", array('uname' => $account, 'type' => $sendType, 'verify' => md5($userId)));
             break;
         case 'forgot':
         case 'unreset':
             $content = url::action("topc_ctl_member@unVerifyEmail", array('uname' => $account, 'type' => $sendType, 'verify' => md5($userId)));
             break;
         case 'signup':
             //手机注册
             $content = url::action("topc_ctl_passport@findPwdThree", array('uname' => $account, 'type' => $sendType));
             break;
     }
     if (!userVcode::send_email($sendType, $account, $content)) {
         return false;
     }
     return true;
 }
示例#2
0
文件: member.php 项目: 453111208/bbc
 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);
 }
示例#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;
 }
示例#4
0
 public function findPwdFour()
 {
     $postData = utils::_filter_input(input::get());
     $userId = $postData['userid'];
     $account = $postData['account'];
     $vcodeData = userVcode::getVcode($account, 'forgot');
     $key = userVcode::getVcodeKey($account, 'forgot');
     if ($account != $vcodeData['account'] || $postData['key'] != md5($vcodeData['vcode'] . $key . $userId)) {
         $msg = app::get('topm')->_('页面已过期,请重新找回密码');
         return $this->splash('failed', null, $msg, true);
     }
     $data['type'] = 'reset';
     $data['new_pwd'] = $postData['password'];
     $data['user_id'] = $postData['userid'];
     $data['confirm_pwd'] = $postData['confirmpwd'];
     try {
         app::get('topm')->rpcCall('user.pwd.update', $data, 'buyer');
     } catch (Exception $e) {
         $msg = $e->getMessage();
         $url = url::action('topm_ctl_passport@findPwd');
         return $this->splash('error', $url, $msg, true);
     }
     $msg = "修改成功";
     $url = url::action('topm_ctl_passport@login');
     return $this->splash('success', $url, $msg, true);
 }
示例#5
0
 public function findPwdFour()
 {
     $postData = utils::_filter_input(input::get());
     $userId = $postData['userid'];
     $account = $postData['account'];
     $vcodeData = userVcode::getVcode($account, 'forgot');
     $key = userVcode::getVcodeKey($account, 'forgot');
     if ($account != $vcodeData['account'] || $postData['key'] != md5($vcodeData['vcode'] . $key . $userId)) {
         $msg = app::get('topc')->_('页面已过期,请重新找回密码');
         return $this->splash('failed', null, $msg, true);
     }
     $validator = validator::make(['password' => $postData['password'], 'password_confirmation' => $postData['confirmpwd']], ['password' => 'min:6|max:20|confirmed'], ['password' => '密码长度不能小于6位!|密码长度不能大于20位!|输入的密码不一致!']);
     if ($validator->fails()) {
         $messages = $validator->messagesInfo();
         foreach ($messages as $error) {
             throw new LogicException($error[0]);
         }
     }
     $data['type'] = 'reset';
     $data['new_pwd'] = $postData['password'];
     $data['user_id'] = $postData['userid'];
     $data['confirm_pwd'] = $postData['confirmpwd'];
     try {
         app::get('topc')->rpcCall('user.pwd.update', $data, 'buyer');
     } catch (Exception $e) {
         $msg = $e->getMessage();
         $url = url::action('topc_ctl_passport@findPwd');
         return $this->splash('error', $url, $msg, true);
     }
     return view::make('topc/passport/forgot/four.html');
 }
示例#6
0
文件: member.php 项目: 453111208/bbc
 /**
  * @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);
 }