Example #1
0
 /**
  * @brief 会员登录处理
  *
  * @return
  */
 public function login()
 {
     try {
         shopAuth::login(input::get('login_account'), input::get('login_password'));
     } catch (Exception $e) {
         $msg = $e->getMessage();
     }
     if (pamAccount::check()) {
         if (input::get('remember_me')) {
             setcookie('LOGINNAME', trim(input::get('login_account')), time() + 31536000, kernel::base_url() . '/');
         }
         $url = url::action('topshop_ctl_index@index');
         $msg = app::get('topshop')->_('登录成功');
         return $this->splash('success', $url, $msg, true);
     } else {
         return $this->splash('error', $url, $msg, true);
     }
 }
Example #2
0
 public function login()
 {
     $validator = validator::make([input::get('account'), input::get('password')], ['required', 'required'], ['请输入账号!', '请输入密码!']);
     if ($validator->fails()) {
         $messages = $validator->messagesInfo();
         foreach ($messages as $error) {
             return $this->splash('error', null, $error[0]);
         }
     }
     $verifycode = input::get('verifycode');
     if (userAuth::isShowVcode('login')) {
         /*if( !input::get('key') || empty($verifycode) || !base_vcode::verify(input::get('key'), $verifycode))
           {
               $msg = app::get('topc')->_('验证码填写错误') ;
               return $this->splash('error',$url,$msg,true);
           }*/
     }
     try {
         if (userAuth::attempt(input::get('account'), input::get('password'))) {
             try {
                 //jnpadd登录c端
                 shopAuth::login(input::get('account'), input::get('password'));
             } catch (Exception $ex) {
             }
             $url = input::get('next_page');
             return $this->splash('success', $url, $msg, true);
         }
     } catch (Exception $e) {
         userAuth::setAttemptNumber();
         if (userAuth::isShowVcode('login')) {
             $url = url::action('topc_ctl_passport@signin');
         }
         $msg = $e->getMessage();
         return $this->splash('error', $url, $msg, true);
     }
 }