public function login()
{
if (Auth::check()) {
echo json_encode(array('succcess' => false, 'state' => 200, 'errMsg' => array('inputMsg' => '该用户已登录,请不要重复登录'), 'no' => 2));
exit;
}
$account = Input::get('user_email');
$password = Input::get('user_psw');
$rememberMe = Input::get('user_remember');
$captcha = Input::get('user_auth');
$ip = $this->getIP();
$codeKey = md5($ip);
$captchaCode = Cache::tags('register', 'code')->get($codeKey);
if ($captcha != $captchaCode) {
echo json_encode(array('success' => false, 'state' => 200, 'errMsg' => array('inputMsg' => '验证码验证失败'), 'no' => 1));
exit;
}
$accountCheck = $this->accountCheck($account);
if (!is_object($accountCheck)) {
echo json_encode(array('success' => false, 'state' => 200, 'errMsg' => array('inputMsg' => '用户不存在'), 'no' => 1));
exit;
}
$passwordCheck = Hash::check($password, $accountCheck->user->password);
if ($passwordCheck) {
if ($rememberMe == 'true') {
Auth::login($accountCheck, true);
} else {
Auth::login($accountCheck);
}
} else {
echo json_encode(array('succcess' => false, 'state' => 200, 'errMsg' => array('inputMsg' => '密码验证失败'), 'no' => 2));
}
echo json_encode(array('success' => true, 'state' => 200, 'nextSrc' => url('usercenter')));
}