Example #1
0
 /**
  * 发送手机验证码
  */
 public function smsAction()
 {
     $sMobile = $this->getParam('mobile');
     $iType = $this->getParam('type');
     $sCode = $this->getParam('code');
     if (!Util_Verify::checkImageCode(Util_Verify::TYPE_FORGET_IMAGE, $sCode)) {
         return $this->showMsg('验证码输入错误', false);
     }
     $aRet = Util_Verify::makeSMSCode($sMobile, $iType);
     if ($aRet['status']) {
         return $this->showMsg('手机验证码发送成功', true);
     } else {
         return $this->showMsg($aRet['data'], false);
     }
 }
Example #2
0
File: User.php Project: pancke/yyaf
 /**
  * 用户登录
  */
 public function loginAction()
 {
     if ($this->isPost()) {
         $iType = $this->getParam('type');
         $sUser = $this->getParam('user');
         $sPass = $this->getParam('pass');
         $sCode = $this->getParam('code');
         $aErr = array();
         if (!Util_Verify::checkImageCode($iType, $sCode)) {
             $aErr['code'] = '验证码错误';
         }
         if (empty($sUser)) {
             $aErr['user'] = '******';
         } else {
             $aUser = Model_User::getUserByEmail($sUser, $iType);
             if (empty($aUser)) {
                 $aErr['user'] = '******';
             } elseif (Model_User::makePassword($sPass) != $aUser['sPassword']) {
                 $aErr['pass'] = '******';
             }
         }
         if (!empty($aErr)) {
             return $this->showMsg($aErr, false);
         }
         $aCookie = Model_User::login($aUser);
         return $this->showMsg($aCookie, true);
     } else {
         $this->assign('iType', max(1, intval($this->getParam('type'))));
         $this->assign('retUrl', $this->getParam('ret'));
         $this->setMeta('user_login', array('sTitle' => '用户登录'));
     }
 }