Authored by xiaowei

login相关bug

@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 {{/ registerHref}} 29 {{/ registerHref}}
30 </li> 30 </li>
31 <li class="tool-options"> 31 <li class="tool-options">
32 - <span>MY有货</span> 32 + <span><a href="{{userCenter}}">MY有货</a></span>
33 <i class="options-icon down iconfont">&#xe604;</i> 33 <i class="options-icon down iconfont">&#xe604;</i>
34 <i class="options-icon up iconfont">&#xe603;</i> 34 <i class="options-icon up iconfont">&#xe603;</i>
35 <div class="tool-select"> 35 <div class="tool-select">
@@ -30,13 +30,15 @@ class PassportModel @@ -30,13 +30,15 @@ class PassportModel
30 public static function getSimpleHeader() 30 public static function getSimpleHeader()
31 { 31 {
32 //拼接简单头部 32 //拼接简单头部
  33 + $radomNum = time();
33 $tool = array( 34 $tool = array(
34 - 'favoriteHref' => Helpers::url('/home/favorite?t=' . time()), //我的收藏链接  
35 - 'couponHref' => Helpers::url('/home/coupons?t=' . time()), //我的优惠券链接  
36 - 'orderHref' => Helpers::url('/home/orders?t=' . time()), //订单中心连接 35 + 'favoriteHref' => Helpers::url('/home/favorite?t=' . $radomNum), //我的收藏链接
  36 + 'couponHref' => Helpers::url('/home/coupons?t=' . $radomNum), //我的优惠券链接
  37 + 'orderHref' => Helpers::url('/home/orders?t=' . $radomNum), //订单中心连接
  38 + 'userCenter' => Helpers::url('/home?t=' . $radomNum),
37 'helpHref' => Helpers::url('/help'), 39 'helpHref' => Helpers::url('/help'),
38 ); 40 );
39 - $tool += array( 41 + $tool+=array(
40 'loginHref' => Helpers::url('/signin.html'), //登录链接,已登录不传 42 'loginHref' => Helpers::url('/signin.html'), //登录链接,已登录不传
41 'registerHref' => Helpers::url('/reg.html'), //注册链接,已登录不传 43 'registerHref' => Helpers::url('/reg.html'), //注册链接,已登录不传
42 ); 44 );
@@ -111,7 +113,7 @@ class PassportModel @@ -111,7 +113,7 @@ class PassportModel
111 $ret = current($data['data']); 113 $ret = current($data['data']);
112 } 114 }
113 } 115 }
114 - return array(); 116 + return $ret;
115 } 117 }
116 118
117 /** 119 /**
@@ -21,10 +21,18 @@ class LoginController extends WebAction @@ -21,10 +21,18 @@ class LoginController extends WebAction
21 $this->setSession('_LOGIN_EXPIRE', time() + 1800); 21 $this->setSession('_LOGIN_EXPIRE', time() + 1800);
22 22
23 //登录后跳转页面 23 //登录后跳转页面
24 - $refer = empty($_SERVER["HTTP_REFERER"]) ? '' : $_SERVER["HTTP_REFERER"]; 24 + $getRefer = $this->get('refer');
  25 + $httpRefer = isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : '';
  26 + $refer = $getRefer ? $getRefer : $httpRefer;
  27 + //检查refre是否为绝对路径,补www.yohobuy.com
  28 + if (!strstr($refer, 'http')) {
  29 + $refer = SITE_MAIN . $refer;
  30 + }
  31 +
25 if (!empty($refer)) { 32 if (!empty($refer)) {
26 $this->setCookie('refer', $refer); 33 $this->setCookie('refer', $refer);
27 } 34 }
  35 +
28 $simpleHeader = PassportModel::getSimpleHeader(); 36 $simpleHeader = PassportModel::getSimpleHeader();
29 //获取登陆页左侧资源 37 //获取登陆页左侧资源
30 $cover = PassportModel::getLeftBanner(PassportModel::SIGNIN_LEFT_BANNER_CODE); 38 $cover = PassportModel::getLeftBanner(PassportModel::SIGNIN_LEFT_BANNER_CODE);
@@ -62,7 +70,7 @@ class LoginController extends WebAction @@ -62,7 +70,7 @@ class LoginController extends WebAction
62 */ 70 */
63 public function authAction() 71 public function authAction()
64 { 72 {
65 - $data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否忘记密码?', 'data' => ''); 73 + $data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否<a href="'.Helpers::url('/passport/back/index').'" target="_blank">忘记密码?</a>', 'data' => '');
66 do { 74 do {
67 /* 判断是不是AJAX请求 */ 75 /* 判断是不是AJAX请求 */
68 if (!$this->isAjax()) { 76 if (!$this->isAjax()) {
@@ -101,18 +109,17 @@ class LoginController extends WebAction @@ -101,18 +109,17 @@ class LoginController extends WebAction
101 $ip = Helpers::getClientIp(); 109 $ip = Helpers::getClientIp();
102 $ipKey = md5('ip_signin_' . $ip); 110 $ipKey = md5('ip_signin_' . $ip);
103 $accountKey = md5('account_signin_' . $account); 111 $accountKey = md5('account_signin_' . $account);
104 - if(!Cache::get($ipKey)){ 112 + if (!Cache::get($ipKey)) {
105 Cache::set($ipKey, 0); 113 Cache::set($ipKey, 0);
106 } 114 }
107 - if(!Cache::get($accountKey)){ 115 + if (!Cache::get($accountKey)) {
108 Cache::set($accountKey, 0); 116 Cache::set($accountKey, 0);
109 } 117 }
110 - Cache::increment($accountKey, 1, 0, 1800);  
111 Cache::increment($ipKey, 1, 0, 3600); 118 Cache::increment($ipKey, 1, 0, 3600);
112 $accountTimes = Cache::get($accountKey); 119 $accountTimes = Cache::get($accountKey);
113 $ipTimes = Cache::get($ipKey); 120 $ipTimes = Cache::get($ipKey);
114 if ($accountTimes > 10) { 121 if ($accountTimes > 10) {
115 - $data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否忘记密码?', 'data' => ''); 122 + $data = array('code' => 400, 'message' => '您的账号已被暂时锁定,请稍后再试', 'data' => '');
116 break; 123 break;
117 } 124 }
118 if ($ipTimes > 100) { 125 if ($ipTimes > 100) {
@@ -121,7 +128,8 @@ class LoginController extends WebAction @@ -121,7 +128,8 @@ class LoginController extends WebAction
121 } 128 }
122 $data = LoginData::signin($area, $account, $password, $shoppingKey); 129 $data = LoginData::signin($area, $account, $password, $shoppingKey);
123 if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['uid'])) { 130 if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['uid'])) {
124 - $data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否忘记密码?', 'data' => ''); 131 + Cache::increment($accountKey, 1, 0, 1800);
  132 + $data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否<a href="'.Helpers::url('/passport/back/index').'" target="_blank">忘记密码?</a>', 'data' => '');
125 break; 133 break;
126 } 134 }
127 135