Beispiel #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;
 }
Beispiel #2
0
 /**
  * @brief 发送验证马
  *
  */
 public function sendVcode($sendType, $uname, $terminal = null)
 {
     if (!$sendType || !$uname) {
         throw new \LogicException(app::get('sysuser')->_('请填写正确的手机号码或者邮箱号'));
         return false;
     }
     $login_type = kernel::single('pam_tools')->checkLoginNameType($uname);
     //手机短信验证码
     if ($sendType && $login_type == 'mobile') {
         if (!userVcode::send_sms($sendType, (string) $uname, $terminal)) {
             throw new \LogicException(app::get('sysuser')->_('验证码发送失败'));
             return false;
         }
     } elseif ($sendType && $login_type == 'email') {
         if (!userVcode::send_email($sendType, (string) $uname, $terminal)) {
             throw new \LogicException(app::get('sysuser')->_('邮件发送失败'));
             return false;
         }
     } else {
         if ($login_type == 'email') {
             throw new \LogicException(app::get('sysuser')->_('请填写正确的邮箱号'));
             return false;
         } elseif ($login_type == 'mobile') {
             throw new \LogicException(app::get('sysuser')->_('请填写正确的手机号'));
             return false;
         } else {
             throw new \LogicException(app::get('sysuser')->_('请填写正确的手机号或者邮箱号'));
             return false;
         }
     }
 }