|
@@ -50,6 +50,11 @@ class LoginController extends AbstractAction |
|
@@ -50,6 +50,11 @@ class LoginController extends AbstractAction |
50
|
*/
|
50
|
*/
|
51
|
public function alipayAction()
|
51
|
public function alipayAction()
|
52
|
{
|
52
|
{
|
|
|
53
|
+ $redirect = $this->_request->getServer('HTTP_REFERER', '');
|
|
|
54
|
+ if($redirect != '')
|
|
|
55
|
+ {
|
|
|
56
|
+ $this->setCookie('alipay_redirect', $redirect);
|
|
|
57
|
+ }
|
53
|
Factory::create('alipay')->getAuthorizeUrl();
|
58
|
Factory::create('alipay')->getAuthorizeUrl();
|
54
|
|
59
|
|
55
|
exit();
|
60
|
exit();
|
|
@@ -61,6 +66,11 @@ class LoginController extends AbstractAction |
|
@@ -61,6 +66,11 @@ class LoginController extends AbstractAction |
61
|
*/
|
66
|
*/
|
62
|
public function qqAction()
|
67
|
public function qqAction()
|
63
|
{
|
68
|
{
|
|
|
69
|
+ $redirect = $this->_request->getServer('HTTP_REFERER', '');
|
|
|
70
|
+ if($redirect != '')
|
|
|
71
|
+ {
|
|
|
72
|
+ $this->setCookie('qq_redirect', $redirect);
|
|
|
73
|
+ }
|
64
|
Factory::create('qqconnect')->getAuthorizeUrl();
|
74
|
Factory::create('qqconnect')->getAuthorizeUrl();
|
65
|
|
75
|
|
66
|
exit();
|
76
|
exit();
|
|
@@ -72,6 +82,11 @@ class LoginController extends AbstractAction |
|
@@ -72,6 +82,11 @@ class LoginController extends AbstractAction |
72
|
*/
|
82
|
*/
|
73
|
public function sinaAction()
|
83
|
public function sinaAction()
|
74
|
{
|
84
|
{
|
|
|
85
|
+ $redirect = $this->_request->getServer('HTTP_REFERER', '');
|
|
|
86
|
+ if($redirect != '')
|
|
|
87
|
+ {
|
|
|
88
|
+ $this->setCookie('sina_redirect', $redirect);
|
|
|
89
|
+ }
|
75
|
header('Location:' . Factory::create('sinaweibo')->getAuthorizeUrl());
|
90
|
header('Location:' . Factory::create('sinaweibo')->getAuthorizeUrl());
|
76
|
|
91
|
|
77
|
exit();
|
92
|
exit();
|
|
@@ -108,8 +123,11 @@ class LoginController extends AbstractAction |
|
@@ -108,8 +123,11 @@ class LoginController extends AbstractAction |
108
|
|
123
|
|
109
|
if($result['code'] == 200)
|
124
|
if($result['code'] == 200)
|
110
|
{
|
125
|
{
|
111
|
- echo '登陆成功';
|
126
|
+ $redirect = $this->_request->getCookie('alipay_redirect');
|
|
|
127
|
+ $redirect && $this->redirect($redirect);
|
112
|
}
|
128
|
}
|
|
|
129
|
+
|
|
|
130
|
+ $this->redirect('/');
|
113
|
}
|
131
|
}
|
114
|
|
132
|
|
115
|
/**
|
133
|
/**
|
|
@@ -121,7 +139,6 @@ class LoginController extends AbstractAction |
|
@@ -121,7 +139,6 @@ class LoginController extends AbstractAction |
121
|
$access = $qqconnect->getAccessToken();
|
139
|
$access = $qqconnect->getAccessToken();
|
122
|
/* 获取QQ腾讯用户的详细信息 */
|
140
|
/* 获取QQ腾讯用户的详细信息 */
|
123
|
$partnerInfo = $qqconnect->getUserInfo($access);
|
141
|
$partnerInfo = $qqconnect->getUserInfo($access);
|
124
|
- var_dump($access, $partnerInfo);
|
|
|
125
|
|
142
|
|
126
|
if ($partnerInfo && is_array($partnerInfo))
|
143
|
if ($partnerInfo && is_array($partnerInfo))
|
127
|
{
|
144
|
{
|
|
@@ -129,9 +146,12 @@ class LoginController extends AbstractAction |
|
@@ -129,9 +146,12 @@ class LoginController extends AbstractAction |
129
|
|
146
|
|
130
|
if($result['code'] == 200)
|
147
|
if($result['code'] == 200)
|
131
|
{
|
148
|
{
|
132
|
- echo '登陆成功';
|
149
|
+ $redirect = $this->_request->getCookie('qq_redirect');
|
|
|
150
|
+ $redirect && $this->redirect($redirect);
|
133
|
}
|
151
|
}
|
134
|
- }
|
152
|
+ }
|
|
|
153
|
+
|
|
|
154
|
+ $this->redirect('/');
|
135
|
}
|
155
|
}
|
136
|
|
156
|
|
137
|
/**
|
157
|
/**
|
|
@@ -143,7 +163,6 @@ class LoginController extends AbstractAction |
|
@@ -143,7 +163,6 @@ class LoginController extends AbstractAction |
143
|
$access = $sina->getAccessToken();
|
163
|
$access = $sina->getAccessToken();
|
144
|
/* 获取QQ腾讯用户的详细信息 */
|
164
|
/* 获取QQ腾讯用户的详细信息 */
|
145
|
$partnerInfo = $sina->getUserInfo($access);
|
165
|
$partnerInfo = $sina->getUserInfo($access);
|
146
|
- var_dump($access, $partnerInfo);
|
|
|
147
|
|
166
|
|
148
|
if ($partnerInfo && is_array($partnerInfo))
|
167
|
if ($partnerInfo && is_array($partnerInfo))
|
149
|
{
|
168
|
{
|
|
@@ -151,8 +170,11 @@ class LoginController extends AbstractAction |
|
@@ -151,8 +170,11 @@ class LoginController extends AbstractAction |
151
|
|
170
|
|
152
|
if($result['code'] == 200)
|
171
|
if($result['code'] == 200)
|
153
|
{
|
172
|
{
|
154
|
- echo '登陆成功';
|
173
|
+ $redirect = $this->_request->getCookie('sina_redirect');
|
|
|
174
|
+ $redirect && $this->redirect($redirect);
|
155
|
}
|
175
|
}
|
156
|
- }
|
176
|
+ }
|
|
|
177
|
+
|
|
|
178
|
+ $this->redirect('/');
|
157
|
}
|
179
|
}
|
158
|
} |
180
|
} |