Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lib
unicaen
auth
Commits
617d3ef9
Commit
617d3ef9
authored
Feb 27, 2014
by
Bertrand Gauthier
Browse files
AJout redirection vers la page demandée avant authentification.
parent
e9c1b964
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/UnicaenAuth/View/RedirectionStrategy.php
View file @
617d3ef9
...
...
@@ -20,13 +20,24 @@ class RedirectionStrategy extends \BjyAuthorize\View\RedirectionStrategy
public
function
onDispatchError
(
MvcEvent
$event
)
{
$request
=
$event
->
getRequest
();
$router
=
$event
->
getRouter
();
if
(
!
$request
->
isXmlHttpRequest
())
{
return
parent
::
onDispatchError
(
$event
);
if
(
$request
->
isXmlHttpRequest
())
{
$sl
=
$event
->
getApplication
()
->
getServiceManager
();
$unauthorizedStrategy
=
$sl
->
get
(
'BjyAuthorize\View\UnauthorizedStrategy'
);
/* @var $unauthorizedStrategy UnauthorizedStrategy */
$unauthorizedStrategy
->
onDispatchError
(
$event
);
return
;
}
$sl
=
$event
->
getApplication
()
->
getServiceManager
();
$unauthorizedStrategy
=
$sl
->
get
(
'BjyAuthorize\View\UnauthorizedStrategy'
);
/* @var $unauthorizedStrategy UnauthorizedStrategy */
$unauthorizedStrategy
->
onDispatchError
(
$event
);
if
(
null
===
$this
->
redirectUri
)
{
if
((
$uri
=
$router
->
getRequestUri
())
&&
$uri
->
getPath
())
{
/* @var $uri \Zend\Uri\Uri */
$this
->
redirectUri
=
$router
->
assemble
(
array
(),
array
(
'name'
=>
$this
->
redirectRoute
,
'query'
=>
array
(
'redirect'
=>
urlencode
(
$uri
->
toString
()))));
}
}
parent
::
onDispatchError
(
$event
);
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment