-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Session destroy #2
Comments
The other way around:
http://php.net/manual/en/function.session-destroy.php Originally posted by @froschdesign at zendframework/zend-expressive-session#29 (comment) |
@froschdesign thank you for quickly responding. I thought about it, but then there is another problem. Suppose a user visits the site: And after doing logout. Code exmple: public function handle(ServerRequestInterface $request): ResponseInterface
{
/** @var LazySession $session */
$session = $request->getAttribute(SessionMiddleware::SESSION_ATTRIBUTE);
$session->clear();
return new RedirectResponse($this->urlHelper->generate('home'), ResponseInfo::HTTP_FOUND);
} Please note that a new session is not created. The user continues to visit the site with the same session after the logout. I think it is incorrect. So: public function handle(ServerRequestInterface $request): ResponseInterface
{
/** @var LazySession $session */
$session = $request->getAttribute(SessionMiddleware::SESSION_ATTRIBUTE);
$session->clear();
$session->regenerate();
return new RedirectResponse($this->urlHelper->generate('home'), ResponseInfo::HTTP_FOUND);
} A new session has been created, but method Originally posted by @nepster-web at zendframework/zend-expressive-session#29 (comment) |
Hello @nepster-web, Originally posted by @pine3ree at zendframework/zend-expressive-session#29 (comment) |
Hello again @nepster-web, @froschdesign Originally posted by @pine3ree at zendframework/zend-expressive-session#29 (comment) |
I see that SessionInterface does not provide the ability to session destroy .
I am writing my session handler that works with the database.
I created my middleware, which is called before zend-expressive-session-ext and zend-expressive-session:
It all works, the difference is not noticeable.
But I had a problem with logout.
Solution to the problem:
So, why the SessionInterface doesn't have a destroy method? I think this can be a problem in some cases.
Originally posted by @nepster-web at zendframework/zend-expressive-session#29
The text was updated successfully, but these errors were encountered: