Authored by xiaowei

login相关bug

... ... @@ -29,7 +29,7 @@
{{/ registerHref}}
</li>
<li class="tool-options">
<span>MY有货</span>
<span><a href="{{userCenter}}">MY有货</a></span>
<i class="options-icon down iconfont">&#xe604;</i>
<i class="options-icon up iconfont">&#xe603;</i>
<div class="tool-select">
... ...
... ... @@ -30,13 +30,15 @@ class PassportModel
public static function getSimpleHeader()
{
//拼接简单头部
$radomNum = time();
$tool = array(
'favoriteHref' => Helpers::url('/home/favorite?t=' . time()), //我的收藏链接
'couponHref' => Helpers::url('/home/coupons?t=' . time()), //我的优惠券链接
'orderHref' => Helpers::url('/home/orders?t=' . time()), //订单中心连接
'favoriteHref' => Helpers::url('/home/favorite?t=' . $radomNum), //我的收藏链接
'couponHref' => Helpers::url('/home/coupons?t=' . $radomNum), //我的优惠券链接
'orderHref' => Helpers::url('/home/orders?t=' . $radomNum), //订单中心连接
'userCenter' => Helpers::url('/home?t=' . $radomNum),
'helpHref' => Helpers::url('/help'),
);
$tool += array(
$tool+=array(
'loginHref' => Helpers::url('/signin.html'), //登录链接,已登录不传
'registerHref' => Helpers::url('/reg.html'), //注册链接,已登录不传
);
... ... @@ -111,7 +113,7 @@ class PassportModel
$ret = current($data['data']);
}
}
return array();
return $ret;
}
/**
... ...
... ... @@ -21,10 +21,18 @@ class LoginController extends WebAction
$this->setSession('_LOGIN_EXPIRE', time() + 1800);
//登录后跳转页面
$refer = empty($_SERVER["HTTP_REFERER"]) ? '' : $_SERVER["HTTP_REFERER"];
$getRefer = $this->get('refer');
$httpRefer = isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : '';
$refer = $getRefer ? $getRefer : $httpRefer;
//检查refre是否为绝对路径,补www.yohobuy.com
if (!strstr($refer, 'http')) {
$refer = SITE_MAIN . $refer;
}
if (!empty($refer)) {
$this->setCookie('refer', $refer);
}
$simpleHeader = PassportModel::getSimpleHeader();
//获取登陆页左侧资源
$cover = PassportModel::getLeftBanner(PassportModel::SIGNIN_LEFT_BANNER_CODE);
... ... @@ -62,7 +70,7 @@ class LoginController extends WebAction
*/
public function authAction()
{
$data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否忘记密码?', 'data' => '');
$data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否<a href="'.Helpers::url('/passport/back/index').'" target="_blank">忘记密码?</a>', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
... ... @@ -101,18 +109,17 @@ class LoginController extends WebAction
$ip = Helpers::getClientIp();
$ipKey = md5('ip_signin_' . $ip);
$accountKey = md5('account_signin_' . $account);
if(!Cache::get($ipKey)){
if (!Cache::get($ipKey)) {
Cache::set($ipKey, 0);
}
if(!Cache::get($accountKey)){
if (!Cache::get($accountKey)) {
Cache::set($accountKey, 0);
}
Cache::increment($accountKey, 1, 0, 1800);
Cache::increment($ipKey, 1, 0, 3600);
$accountTimes = Cache::get($accountKey);
$ipTimes = Cache::get($ipKey);
if ($accountTimes > 10) {
$data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否忘记密码?', 'data' => '');
$data = array('code' => 400, 'message' => '您的账号已被暂时锁定,请稍后再试', 'data' => '');
break;
}
if ($ipTimes > 100) {
... ... @@ -121,7 +128,8 @@ class LoginController extends WebAction
}
$data = LoginData::signin($area, $account, $password, $shoppingKey);
if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['uid'])) {
$data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否忘记密码?', 'data' => '');
Cache::increment($accountKey, 1, 0, 1800);
$data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否<a href="'.Helpers::url('/passport/back/index').'" target="_blank">忘记密码?</a>', 'data' => '');
break;
}
... ...