|
@@ -44,6 +44,9 @@ class LoginController extends AbstractAction |
|
@@ -44,6 +44,9 @@ class LoginController extends AbstractAction |
44
|
|
44
|
|
45
|
// 渲染模板
|
45
|
// 渲染模板
|
46
|
$this->_view->display('index', $data);
|
46
|
$this->_view->display('index', $data);
|
|
|
47
|
+
|
|
|
48
|
+ // 设置登录有效时间30分钟, 防机器刷
|
|
|
49
|
+ $this->setSession('_LOGIN_EXPIRE', time() + 1800);
|
47
|
}
|
50
|
}
|
48
|
|
51
|
|
49
|
/**
|
52
|
/**
|
|
@@ -67,6 +70,9 @@ class LoginController extends AbstractAction |
|
@@ -67,6 +70,9 @@ class LoginController extends AbstractAction |
67
|
$data['countrys'] = RegData::getAreasData(); // 地区信息列表
|
70
|
$data['countrys'] = RegData::getAreasData(); // 地区信息列表
|
68
|
// 渲染模板
|
71
|
// 渲染模板
|
69
|
$this->_view->display('international', $data);
|
72
|
$this->_view->display('international', $data);
|
|
|
73
|
+
|
|
|
74
|
+ // 设置登录有效时间30分钟, 防机器刷
|
|
|
75
|
+ $this->setSession('_LOGIN_EXPIRE', time() + 1800);
|
70
|
}
|
76
|
}
|
71
|
|
77
|
|
72
|
/**
|
78
|
/**
|
|
@@ -80,6 +86,7 @@ class LoginController extends AbstractAction |
|
@@ -80,6 +86,7 @@ class LoginController extends AbstractAction |
80
|
$this->setCookie('_SPK', '');
|
86
|
$this->setCookie('_SPK', '');
|
81
|
// 清除服务端会话
|
87
|
// 清除服务端会话
|
82
|
$this->setSession('_TOKEN', '');
|
88
|
$this->setSession('_TOKEN', '');
|
|
|
89
|
+ $this->setSession('_LOGIN_UID', '');
|
83
|
|
90
|
|
84
|
$refer = $this->server('HTTP_REFERER', SITE_MAIN);
|
91
|
$refer = $this->server('HTTP_REFERER', SITE_MAIN);
|
85
|
$token = $this->get('token');
|
92
|
$token = $this->get('token');
|
|
@@ -123,6 +130,12 @@ class LoginController extends AbstractAction |
|
@@ -123,6 +130,12 @@ class LoginController extends AbstractAction |
123
|
break;
|
130
|
break;
|
124
|
}
|
131
|
}
|
125
|
|
132
|
|
|
|
133
|
+ /* 设置登录有效时间30分钟, 防机器刷 */
|
|
|
134
|
+ $expire = $this->getSession('_LOGIN_EXPIRE');
|
|
|
135
|
+ if (empty($expire) || $expire < time()) {
|
|
|
136
|
+ break;
|
|
|
137
|
+ }
|
|
|
138
|
+
|
126
|
/* 调用登录接口进行登录 */
|
139
|
/* 调用登录接口进行登录 */
|
127
|
// 获取未登录时的唯一识别码
|
140
|
// 获取未登录时的唯一识别码
|
128
|
$shoppingKey = Helpers::getShoppingKeyByCookie();
|
141
|
$shoppingKey = Helpers::getShoppingKeyByCookie();
|
|
@@ -143,6 +156,8 @@ class LoginController extends AbstractAction |
|
@@ -143,6 +156,8 @@ class LoginController extends AbstractAction |
143
|
$token = Helpers::makeToken($data['data']['uid']);
|
156
|
$token = Helpers::makeToken($data['data']['uid']);
|
144
|
$this->setCookie('_TOKEN', $token);
|
157
|
$this->setCookie('_TOKEN', $token);
|
145
|
$this->setSession('_TOKEN', $token);
|
158
|
$this->setSession('_TOKEN', $token);
|
|
|
159
|
+ $this->setSession('_LOGIN_UID', $data['data']['uid']);
|
|
|
160
|
+
|
146
|
} while (false);
|
161
|
} while (false);
|
147
|
|
162
|
|
148
|
$this->echoJson($data);
|
163
|
$this->echoJson($data);
|
|
@@ -213,6 +228,7 @@ class LoginController extends AbstractAction |
|
@@ -213,6 +228,7 @@ class LoginController extends AbstractAction |
213
|
$token = Helpers::makeToken($result['data']['uid']);
|
228
|
$token = Helpers::makeToken($result['data']['uid']);
|
214
|
$this->setCookie('_TOKEN', $token);
|
229
|
$this->setCookie('_TOKEN', $token);
|
215
|
$this->setSession('_TOKEN', $token);
|
230
|
$this->setSession('_TOKEN', $token);
|
|
|
231
|
+ $this->setSession('_LOGIN_UID', $result['data']['uid']);
|
216
|
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
|
232
|
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
|
217
|
} else {
|
233
|
} else {
|
218
|
$this->go($refer);
|
234
|
$this->go($refer);
|
|
@@ -250,6 +266,7 @@ class LoginController extends AbstractAction |
|
@@ -250,6 +266,7 @@ class LoginController extends AbstractAction |
250
|
$token = Helpers::makeToken($result['data']['uid']);
|
266
|
$token = Helpers::makeToken($result['data']['uid']);
|
251
|
$this->setCookie('_TOKEN', $token);
|
267
|
$this->setCookie('_TOKEN', $token);
|
252
|
$this->setSession('_TOKEN', $token);
|
268
|
$this->setSession('_TOKEN', $token);
|
|
|
269
|
+ $this->setSession('_LOGIN_UID', $result['data']['uid']);
|
253
|
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
|
270
|
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
|
254
|
} else {
|
271
|
} else {
|
255
|
$this->go($refer);
|
272
|
$this->go($refer);
|
|
@@ -287,6 +304,7 @@ class LoginController extends AbstractAction |
|
@@ -287,6 +304,7 @@ class LoginController extends AbstractAction |
287
|
$token = Helpers::makeToken($result['data']['uid']);
|
304
|
$token = Helpers::makeToken($result['data']['uid']);
|
288
|
$this->setCookie('_TOKEN', $token);
|
305
|
$this->setCookie('_TOKEN', $token);
|
289
|
$this->setSession('_TOKEN', $token);
|
306
|
$this->setSession('_TOKEN', $token);
|
|
|
307
|
+ $this->setSession('_LOGIN_UID', $result['data']['uid']);
|
290
|
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
|
308
|
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
|
291
|
} else {
|
309
|
} else {
|
292
|
$this->go($refer);
|
310
|
$this->go($refer);
|