0
我知道一個成功的用戶登錄後,我可以做一個重定向到URL:重定向到一個路由的用戶登錄後
return $this->redirect()->toUrl('/user/login?redirect=http://www.myurl.com');
現在,我願意做同樣的事情,而不是註冊的路線:
'sso-post-login' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/sso-post-login',
'defaults' => array(
'controller' => 'Application\Controller\Index',
'action' => 'sso-post-login',
),
'may_terminate' => true,
),
),
但下面不工作:
return $this->redirect()->toUrl('/user/login?redirect=/sso-post-login');
它不打我的行動:
public function ssoPostLoginAction() {
error_log("In sso post login action");
$originUrl = Common::getCookie('sso_post_login', $this->getRequest());
$sessionCookie = Common::getCookie('PHPSESSID', $this->getRequest());
if (null != $sessionCookie && null != $this->getUserService()->getAuthService()->getIdentity()) {
$email = $this->getUserService()->getAuthService()->getIdentity()->getEmail();
$jwtCredentials = $this->buildJWTLoginToken($email);
$originUrl .= "?jwt=" . $jwtCredentials;
return $this->redirect()->toUrl($originUrl);
}
}
它只是在登錄完成後重定向到主頁面。
沒有,沒有任何理由,我很樂意使用,將工作的任何解決方案。我試過你的解決方案,但它重定向到主頁面,而不是重定向到'sso-post-login'。 – Stephane
您確定您可以在瀏覽器中訪問「http:// www.myurl.com/sso-post-login」嗎?它不會拋出任何錯誤或重定向到主頁面嗎? – SzymonM
確實,就是這樣。我忘了將它再次添加到'bjyauthorize.php'文件中。 – Stephane