Ejemplo n.º 1
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'))) {
             $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);
     }
 }
Ejemplo n.º 2
0
 /**
  * @brief 会员登录处理
  *
  * @return
  */
 public function login()
 {
     try {
         shopAuth::login(input::get('login_account'), input::get('login_password'));
         //jnpadd登录c端
         userAuth::attempt(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);
     }
 }
Ejemplo n.º 3
0
 public function bindExistsUser()
 {
     $params = input::get();
     $verifyCode = $params['verifycode'];
     $verifyKey = $params['vcodekey'];
     $loginName = $params['uname'];
     $password = $params['password'];
     if (!$verifyKey || ($b = empty($verifyCode) || ($c = !base_vcode::verify($verifyKey, $verifyCode)))) {
         $msg = app::get('topc')->_('验证码填写错误');
         return $this->splash('error', null, $msg, true);
     }
     try {
         if (userAuth::attempt($loginName, $password)) {
             kernel::single('pam_trust_user')->bind(userAuth::id());
             $url = url::action('topc_ctl_default@index');
             return $this->splash('success', $url, $msg, true);
         }
     } catch (Exception $e) {
         $msg = $e->getMessage();
         return $this->splash('error', null, $msg, true);
     }
 }
Ejemplo n.º 4
0
 public function login()
 {
     $verifycode = input::get('verifycode');
     if (userAuth::isShowVcode('login')) {
         if (!input::get('key') || empty($verifycode) || !base_vcode::verify(input::get('key'), $verifycode)) {
             $msg = app::get('topm')->_('验证码填写错误');
             return $this->splash('error', $url, $msg, true);
         }
     }
     try {
         if (userAuth::attempt(input::get('account'), input::get('password'))) {
             $url = $this->__getFromUrl();
             return $this->splash('success', $url, $msg, true);
         }
     } catch (Exception $e) {
         userAuth::setAttemptNumber();
         if (userAuth::isShowVcode('login')) {
             $url = url::action('topm_ctl_passport@signin');
         }
         $msg = $e->getMessage();
         return $this->splash('error', $url, $msg, true);
     }
 }